From 7f9b28f2c1a867b515c2b59349da9a141abd255c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 25 May 2016 14:56:29 +0200 Subject: cache isLocal for shared storage --- apps/files_sharing/lib/sharedstorage.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 1970e297252..dbf2fe05480 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -44,6 +44,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { private $share; // the shared resource private $files = array(); private static $isInitialized = array(); + private $local = null; /** * @var \OC\Files\View @@ -705,9 +706,12 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { } public function isLocal() { - $this->init(); - $ownerPath = $this->ownerView->getPath($this->share['item_source']); - list($targetStorage) = $this->ownerView->resolvePath($ownerPath); - return $targetStorage->isLocal(); + if (!is_null($this->local)) { + $this->init(); + $ownerPath = $this->ownerView->getPath($this->share['item_source']); + list($targetStorage) = $this->ownerView->resolvePath($ownerPath); + $this->local = $targetStorage->isLocal(); + } + return $this->local; } } -- cgit v1.2.3