From 3189c22ff391b6cc7099b44a33feea8dee2bc3f9 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 13 Jun 2016 17:47:57 +0200 Subject: [PATCH 01/12] Use capped cache for encryption's user access list --- lib/private/encryption/file.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/private/encryption/file.php b/lib/private/encryption/file.php index ec55c2cea0023..bd045c20294b5 100644 --- a/lib/private/encryption/file.php +++ b/lib/private/encryption/file.php @@ -22,6 +22,8 @@ namespace OC\Encryption; +use OC\Cache\CappedMemoryCache; + class File implements \OCP\Encryption\IFile { /** @var Util */ @@ -36,6 +38,7 @@ class File implements \OCP\Encryption\IFile { public function __construct(Util $util) { $this->util = $util; + $this->cache = new CappedMemoryCache(); } From 0934153ed2be11f692a2febe320a5a48c1ba0490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 14 Jun 2016 12:11:35 +0200 Subject: [PATCH 02/12] Use an explicit version of sabre/dav to allow caching on the jenkins slaves - fixes #25087 (#25089) --- build/integration/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/integration/composer.json b/build/integration/composer.json index a9516391a410b..29f73f2064ac9 100644 --- a/build/integration/composer.json +++ b/build/integration/composer.json @@ -4,6 +4,6 @@ "behat/behat": "^3.0", "guzzlehttp/guzzle": "~5.0", "jarnaiz/behat-junit-formatter": "^1.3", - "sabre/dav": "3.0.x-dev" + "sabre/dav": "3.0.9" } } From 459aa933b982bb45d47b61cda5078c751f161e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 7 Jun 2016 11:40:04 +0200 Subject: [PATCH 03/12] decrease initial users to load to 50 Prevents timeouts on the initial loading of users. proper fix will be in https://github.com/owncloud/core/pull/10994 Workaround for https://github.com/owncloud/core/issues/24734 --- settings/js/users/users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 02d3a25be70ef..eb041054cdca0 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -14,7 +14,7 @@ var UserList = { availableGroups: [], offset: 0, usersToLoad: 10, //So many users will be loaded when user scrolls down - initialUsersToLoad: 250, //initial number of users to load + initialUsersToLoad: 50, //initial number of users to load currentGid: '', filter: '', From 38663e13cc5a8781fb61dc45f6696127b7a54c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 10 Jun 2016 11:16:32 +0200 Subject: [PATCH 04/12] Allow empty host when installing on oracle via CLI (#25034) --- core/command/maintenance/install.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/command/maintenance/install.php b/core/command/maintenance/install.php index b1b63b9b3bd6c..12a61d6341a09 100644 --- a/core/command/maintenance/install.php +++ b/core/command/maintenance/install.php @@ -106,7 +106,12 @@ protected function validateInput(InputInterface $input, OutputInterface $output, $dbUser = $input->getOption('database-user'); $dbPass = $input->getOption('database-pass'); $dbName = $input->getOption('database-name'); - $dbHost = $input->getOption('database-host'); + if ($db === 'oci') { + // an empty hostname needs to be read from the raw parameters + $dbHost = $input->getParameterOption('--database-host', ''); + } else { + $dbHost = $input->getOption('database-host'); + } $dbTablePrefix = 'oc_'; if ($input->hasParameterOption('--database-table-prefix')) { $dbTablePrefix = (string) $input->getOption('database-table-prefix'); From ac56629c867ed2498f01eb696c3b3830b19cfc96 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 15 Jun 2016 13:02:39 +0200 Subject: [PATCH 05/12] Capped cache for cache info in UserMountCache --- lib/private/files/config/usermountcache.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/private/files/config/usermountcache.php b/lib/private/files/config/usermountcache.php index 78b1997278740..76281ef62e153 100644 --- a/lib/private/files/config/usermountcache.php +++ b/lib/private/files/config/usermountcache.php @@ -35,6 +35,7 @@ use OCP\ILogger; use OCP\IUser; use OCP\IUserManager; +use OC\Cache\CappedMemoryCache; /** * Cache mounts points per user in the cache so we can easilly look them up @@ -50,15 +51,23 @@ class UserMountCache implements IUserMountCache { */ private $userManager; - /** @var ICachedMountInfo[][] [$userId => [$cachedMountInfo, ....], ...] */ - private $mountsForUsers = []; + /** + * Cached mount info. + * Map of $userId to ICachedMountInfo. + * + * @var ICache + **/ + private $mountsForUsers; /** * @var ILogger */ private $logger; - private $cacheInfoCache = []; + /** + * @var ICache + */ + private $cacheInfoCache; /** * UserMountCache constructor. @@ -71,6 +80,8 @@ public function __construct(IDBConnection $connection, IUserManager $userManager $this->connection = $connection; $this->userManager = $userManager; $this->logger = $logger; + $this->cacheInfoCache = new CappedMemoryCache(); + $this->mountsForUsers = new CappedMemoryCache(); } public function registerMounts(IUser $user, array $mounts) { From 43065e736996b898a20d502e24dabf7ed79d0b32 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 15 Jun 2016 21:37:01 +0200 Subject: [PATCH 06/12] load authentication apps first --- ocs/v1.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ocs/v1.php b/ocs/v1.php index 32fcfdd46d111..74b6ac13895dd 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -43,6 +43,8 @@ use Symfony\Component\Routing\Exception\MethodNotAllowedException; try { + OC_App::loadApps(['session']); + OC_App::loadApps(['authentication']); // load all apps to get all api routes properly setup OC_App::loadApps(); From 5e6a724c5c2dde2524f46ab641fe5dff17001135 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 16 Jun 2016 11:43:57 +0200 Subject: [PATCH 07/12] fix grouped input fields, make sure they take precedence --- core/css/styles.css | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/core/css/styles.css b/core/css/styles.css index 4a25247d23fe3..830ff4bacbb27 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -365,26 +365,26 @@ body { } #body-login .grouptop input, .grouptop input { - margin-bottom: 0; - border-bottom: 0; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; + margin-bottom: 0 !important; + border-bottom: 0 !important; + border-bottom-left-radius: 0 !important; + border-bottom-right-radius: 0 !important; } #body-login .groupmiddle input, .groupmiddle input { - margin-top: 0; - margin-bottom: 0; - border-top: 0; - border-bottom: 0; - border-radius: 0; + margin-top: 0 !important; + margin-bottom: 0 !important; + border-top: 0 !important; + border-bottom: 0 !important; + border-radius: 0 !important; box-shadow: 0 1px 0 rgba(0,0,0,.1) inset !important; } #body-login .groupbottom input, .groupbottom input { - margin-top: 0; - border-top: 0; - border-top-right-radius: 0; - border-top-left-radius: 0; + margin-top: 0 !important; + border-top: 0 !important; + border-top-right-radius: 0 !important; + border-top-left-radius: 0 !important; box-shadow: 0 1px 0 rgba(0,0,0,.1) inset !important; } #body-login .groupbottom input[type=submit] { From 280c288bc0936dd6c512c8b47f378303c6e15bcd Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 16 Jun 2016 16:05:14 +0200 Subject: [PATCH 08/12] Convert Dropbox Forbidden exception to StorageNotAvailableException --- apps/files_external/lib/dropbox.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php index 8381ccbae59cf..bfddc98f5a31c 100644 --- a/apps/files_external/lib/dropbox.php +++ b/apps/files_external/lib/dropbox.php @@ -32,6 +32,7 @@ use GuzzleHttp\Exception\RequestException; use Icewind\Streams\IteratorDirectory; use Icewind\Streams\RetryWrapper; +use OCP\Files\StorageNotAvailableException; require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php'; @@ -94,6 +95,8 @@ private function getDropBoxMetaData($path, $list = false) { if ($list) { try { $response = $this->dropbox->getMetaData($path); + } catch (\Dropbox_Exception_Forbidden $e) { + throw new StorageNotAvailableException('Dropbox API rate limit exceeded', StorageNotAvailableException::STATUS_ERROR, $e); } catch (\Exception $exception) { \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR); return false; @@ -127,6 +130,8 @@ private function getDropBoxMetaData($path, $list = false) { return $response; } return null; + } catch (\Dropbox_Exception_Forbidden $e) { + throw new StorageNotAvailableException('Dropbox API rate limit exceeded', StorageNotAvailableException::STATUS_ERROR, $e); } catch (\Exception $exception) { if ($exception instanceof \Dropbox_Exception_NotFound) { // don't log, might be a file_exist check From 07436d089bff1bafae632e57b2847c7e99c550bd Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 8 Mar 2016 16:12:17 +0100 Subject: [PATCH 09/12] Do not recurse link share fetching * Might fix an issue on oracle --- lib/private/share20/manager.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php index 06d4029bec9fe..35a019b23342b 100644 --- a/lib/private/share20/manager.php +++ b/lib/private/share20/manager.php @@ -907,6 +907,11 @@ public function getSharesBy($userId, $shareType, $path = null, $reshares = false break; } + // If there was no limit on the select we are done + if ($limit === -1) { + break; + } + $offset += $added; // Fetch again $limit shares From cf3b5e3e86954a1b8a98f70f9a85dc2380a8b28e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 17 Jun 2016 12:46:28 +0200 Subject: [PATCH 10/12] Capped cache for user config --- lib/private/allconfig.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/private/allconfig.php b/lib/private/allconfig.php index b4888fde0222e..e982b06473645 100644 --- a/lib/private/allconfig.php +++ b/lib/private/allconfig.php @@ -27,6 +27,7 @@ */ namespace OC; +use OC\Cache\CappedMemoryCache; use OCP\IDBConnection; use OCP\PreConditionNotMetException; @@ -58,14 +59,15 @@ class AllConfig implements \OCP\IConfig { * - deleteAllUserValues * - deleteAppFromAllUsers * - * @var array $userCache + * @var CappedMemoryCache $userCache */ - private $userCache = array(); + private $userCache; /** * @param SystemConfig $systemConfig */ function __construct(SystemConfig $systemConfig) { + $this->userCache = new CappedMemoryCache(); $this->systemConfig = $systemConfig; } From f11e4860259d814a85a7142513b83fb8b39a3eaf Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 20 Jun 2016 12:02:04 +0200 Subject: [PATCH 11/12] Make getShareFolder use given view instead of static FS (#25150) --- apps/files_sharing/lib/helper.php | 12 ++++++++---- apps/files_sharing/lib/sharedmount.php | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/files_sharing/lib/helper.php b/apps/files_sharing/lib/helper.php index ee6af9939ed17..612df1b207a79 100644 --- a/apps/files_sharing/lib/helper.php +++ b/apps/files_sharing/lib/helper.php @@ -302,19 +302,23 @@ public static function isIncomingServer2serverShareEnabled() { /** * get default share folder * + * @param \OC\Files\View * @return string */ - public static function getShareFolder() { + public static function getShareFolder($view = null) { + if ($view === null) { + $view = Filesystem::getView(); + } $shareFolder = \OC::$server->getConfig()->getSystemValue('share_folder', '/'); $shareFolder = Filesystem::normalizePath($shareFolder); - if (!Filesystem::file_exists($shareFolder)) { + if (!$view->file_exists($shareFolder)) { $dir = ''; $subdirs = explode('/', $shareFolder); foreach ($subdirs as $subdir) { $dir = $dir . '/' . $subdir; - if (!Filesystem::is_dir($dir)) { - Filesystem::mkdir($dir); + if (!$view->is_dir($dir)) { + $view->mkdir($dir); } } } diff --git a/apps/files_sharing/lib/sharedmount.php b/apps/files_sharing/lib/sharedmount.php index 1e554cc59482f..3a65794b606a1 100644 --- a/apps/files_sharing/lib/sharedmount.php +++ b/apps/files_sharing/lib/sharedmount.php @@ -75,7 +75,7 @@ private function verifyMountPoint(&$share) { $parent = dirname($share['file_target']); if (!$this->recipientView->is_dir($parent)) { - $parent = Helper::getShareFolder(); + $parent = Helper::getShareFolder($this->recipientView); } $newMountPoint = \OCA\Files_Sharing\Helper::generateUniqueTarget( From dc3db4e1c0c815c7e9bedc8c03a8807fbbb5dc9e Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 17 Jun 2016 11:00:09 +0200 Subject: [PATCH 12/12] Delay files_sharing's registerMountProviders This moves registerMountProviders until after the sharing backends were registered. In some situations registerMountProviders will trigger listeners which might require filesystem access which itself would mount shares, which itself requires the sharing backends to be initialized. --- apps/files_sharing/appinfo/app.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 29202c15b22f3..628921c324819 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -41,8 +41,6 @@ \OC::$CLASSPATH['OCA\Files\Share\Maintainer'] = 'files_sharing/lib/maintainer.php'; \OC::$CLASSPATH['OCA\Files\Share\Proxy'] = 'files_sharing/lib/proxy.php'; -$application = new Application(); -$application->registerMountProviders(); \OCP\App::registerAdmin('files_sharing', 'settings-admin'); \OCP\App::registerPersonal('files_sharing', 'settings-personal'); @@ -52,6 +50,9 @@ \OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); +$application = new Application(); +$application->registerMountProviders(); + $eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher->addListener( 'OCA\Files::loadAdditionalScripts',