From: Bjoern Schiessle Date: Mon, 2 Jun 2014 13:06:15 +0000 (+0200) Subject: name the storage wrapper to make sure that we don't apply the wrapper multiple times X-Git-Tag: v7.0.0alpha2~127^2~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ab6680e9ab4c7ba24bcd47c01b46d2ca8993bc96;p=nextcloud-server.git name the storage wrapper to make sure that we don't apply the wrapper multiple times --- diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index ad7213d2368..2cc4a2130eb 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -168,8 +168,8 @@ class Filesystem { /** * @param callable $wrapper */ - public static function addStorageWrapper($wrapper) { - self::getLoader()->addStorageWrapper($wrapper); + public static function addStorageWrapper($wrapperName, $wrapper) { + self::getLoader()->addStorageWrapper($wrapperName, $wrapper); $mounts = self::getMountManager()->getAll(); foreach ($mounts as $mount) { diff --git a/lib/private/files/storage/loader.php b/lib/private/files/storage/loader.php index 966234cb04d..c75a0a976a7 100644 --- a/lib/private/files/storage/loader.php +++ b/lib/private/files/storage/loader.php @@ -21,8 +21,8 @@ class Loader { * * @param callable $callback */ - public function addStorageWrapper($callback) { - $this->storageWrappers[] = $callback; + public function addStorageWrapper($wrapperName, $callback) { + $this->storageWrappers[$wrapperName] = $callback; } /** diff --git a/lib/private/util.php b/lib/private/util.php index 8cc48c03462..da67dbcee54 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -53,7 +53,7 @@ class OC_Util { //if we aren't logged in, there is no use to set up the filesystem if( $user != "" ) { - \OC\Files\Filesystem::addStorageWrapper(function($mountPoint, $storage){ + \OC\Files\Filesystem::addStorageWrapper('oc_quota', function($mountPoint, $storage){ // set up quota for home storages, even for other users // which can happen when using sharing @@ -72,7 +72,7 @@ class OC_Util { }); // Set up flock - \OC\Files\Filesystem::addStorageWrapper(function($mountPoint, /** @var \OC\Files\Storage\Storage|null $storage */ $storage){ + \OC\Files\Filesystem::addStorageWrapper('oc_flock', function($mountPoint, /** @var \OC\Files\Storage\Storage|null $storage */ $storage){ // lock files on all local storage if ($storage instanceof \OC\Files\Storage\Storage && $storage->isLocal()) { return new \OC\Files\Storage\Wrapper\LockingWrapper(array('storage' => $storage));