diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-09-17 08:55:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 08:55:35 +0200 |
commit | b0c04a3e0c2d2c8f99e112afc410441aa36093a1 (patch) | |
tree | 3071af83021953d0d650dce46b6c7a13253fe5a2 /apps/files_sharing | |
parent | 05edd1e5d6156766d072a9bf4782293b37210977 (diff) | |
parent | cfde74442c67b9a6e639536536c18e4c6d4f7a0e (diff) | |
download | nextcloud-server-b0c04a3e0c2d2c8f99e112afc410441aa36093a1.tar.gz nextcloud-server-b0c04a3e0c2d2c8f99e112afc410441aa36093a1.zip |
Merge pull request #22867 from nextcloud/shared-storage-init-less
Shared storage optimizations
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/lib/SharedStorage.php | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index 1735cab43f6..7625c0bba44 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -33,6 +33,7 @@ namespace OCA\Files_Sharing; use OC\Files\Cache\FailedCache; +use OC\Files\Cache\NullWatcher; use OC\Files\Filesystem; use OC\Files\Storage\FailedStorage; use OC\Files\Storage\Wrapper\PermissionsMask; @@ -125,11 +126,12 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto $this->initialized = true; try { Filesystem::initMountPoints($this->superShare->getShareOwner()); - $sourcePath = $this->ownerView->getPath($this->superShare->getNodeId()); - list($this->nonMaskedStorage, $this->rootPath) = $this->ownerView->resolvePath($sourcePath); + $storageId = $this->superShare->getNodeCacheEntry() ? $this->superShare->getNodeCacheEntry()->getStorageId() : null; + $sourcePath = $this->ownerView->getPath($this->superShare->getNodeId(), $storageId); + [$this->nonMaskedStorage, $this->rootPath] = $this->ownerView->resolvePath($sourcePath); $this->storage = new PermissionsMask([ 'storage' => $this->nonMaskedStorage, - 'mask' => $this->superShare->getPermissions() + 'mask' => $this->superShare->getPermissions(), ]); } catch (NotFoundException $e) { // original file not accessible or deleted, set FailedStorage @@ -160,7 +162,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto if ($class === '\OC\Files\Storage\Common') { return true; } - if (in_array($class, ['\OC\Files\Storage\Home', '\OC\Files\ObjectStore\HomeObjectStoreStorage'])) { + if (in_array($class, ['\OC\Files\Storage\Home', '\OC\Files\ObjectStore\HomeObjectStoreStorage', '\OCP\Files\IHomeStorage'])) { return false; } return parent::instanceOfStorage($class); @@ -223,7 +225,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto } /** @var IStorage $storage */ /** @var string $internalPath */ - list($storage, $internalPath) = $this->resolvePath($path); + [$storage, $internalPath] = $this->resolvePath($path); return $storage->isReadable($internalPath); } @@ -377,7 +379,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto if (!$storage) { $storage = $this; } - $sourceRoot = $this->getSourceRootInfo(); + $sourceRoot = $this->getSourceRootInfo(); if ($this->storage instanceof FailedStorage) { return new FailedCache(); } @@ -397,6 +399,11 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto return $this->superShare->getShareOwner(); } + public function getWatcher($path = '', $storage = null) { + // cache updating is handled by the share source + return new NullWatcher(); + } + /** * unshare complete storage, also the grouped shares * @@ -417,7 +424,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto */ public function acquireLock($path, $type, ILockingProvider $provider) { /** @var \OCP\Files\Storage $targetStorage */ - list($targetStorage, $targetInternalPath) = $this->resolvePath($path); + [$targetStorage, $targetInternalPath] = $this->resolvePath($path); $targetStorage->acquireLock($targetInternalPath, $type, $provider); // lock the parent folders of the owner when locking the share as recipient if ($path === '') { @@ -433,7 +440,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto */ public function releaseLock($path, $type, ILockingProvider $provider) { /** @var \OCP\Files\Storage $targetStorage */ - list($targetStorage, $targetInternalPath) = $this->resolvePath($path); + [$targetStorage, $targetInternalPath] = $this->resolvePath($path); $targetStorage->releaseLock($targetInternalPath, $type, $provider); // unlock the parent folders of the owner when unlocking the share as recipient if ($path === '') { @@ -449,7 +456,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto */ public function changeLock($path, $type, ILockingProvider $provider) { /** @var \OCP\Files\Storage $targetStorage */ - list($targetStorage, $targetInternalPath) = $this->resolvePath($path); + [$targetStorage, $targetInternalPath] = $this->resolvePath($path); $targetStorage->changeLock($targetInternalPath, $type, $provider); } @@ -460,7 +467,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto // shares do not participate in availability logic return [ 'available' => true, - 'last_checked' => 0 + 'last_checked' => 0, ]; } |