diff options
author | Robin Appelman <robin@icewind.nl> | 2016-08-22 12:27:56 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2016-08-22 12:27:56 +0200 |
commit | 3ed01e845994192cae29c81024ec1921a96ec31d (patch) | |
tree | b58a41075163a408be49e9e8655622e8877ecc58 /apps | |
parent | 95570d607c4d6b17db6a436f11b4c675ce9a8212 (diff) | |
download | nextcloud-server-3ed01e845994192cae29c81024ec1921a96ec31d.tar.gz nextcloud-server-3ed01e845994192cae29c81024ec1921a96ec31d.zip |
Lazy init shared storage
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 92900ccda69..7a7bb58982b 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -61,11 +61,6 @@ class Shared extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage { */ private $sourceRootInfo; - /** - * @var IStorage - */ - private $sourceStorage; - /** @var string */ private $user; @@ -83,13 +78,9 @@ class Shared extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage { $this->user = $arguments['user']; - Filesystem::initMountPoints($this->superShare->getShareOwner()); - $sourcePath = $this->ownerView->getPath($this->superShare->getNodeId()); - list($storage, $internalPath) = $this->ownerView->resolvePath($sourcePath); - parent::__construct([ - 'storage' => $storage, - 'root' => $internalPath, + 'storage' => null, + 'root' => null, ]); } @@ -101,8 +92,8 @@ class Shared extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage { try { Filesystem::initMountPoints($this->superShare->getShareOwner()); $sourcePath = $this->ownerView->getPath($this->superShare->getNodeId()); - list($this->sourceStorage, $sourceInternalPath) = $this->ownerView->resolvePath($sourcePath); - $this->sourceRootInfo = $this->sourceStorage->getCache()->get($sourceInternalPath); + list($this->storage, $this->rootPath) = $this->ownerView->resolvePath($sourcePath); + $this->sourceRootInfo = $this->storage->getCache()->get($this->rootPath); } catch (\Exception $e) { $this->logger->logException($e); } @@ -302,13 +293,13 @@ class Shared extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage { public function getCache($path = '', $storage = null) { $this->init(); - if (is_null($this->sourceStorage)) { + if (is_null($this->storage)) { return new FailedCache(false); } if (!$storage) { $storage = $this; } - return new \OCA\Files_Sharing\Cache($storage, $this->sourceStorage, $this->sourceRootInfo); + return new \OCA\Files_Sharing\Cache($storage, $this->storage, $this->sourceRootInfo); } public function getScanner($path = '', $storage = null) { @@ -408,8 +399,9 @@ class Shared extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage { // shares do not participate in availability logic } - public function getSourceStorage() { - return $this->sourceStorage; + public function getWrapperStorage() { + $this->init(); + return $this->storage; } public function file_get_contents($path) { |