From e0a5f3b5707d505833d159652391fb84da88487c Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 23 May 2014 17:15:05 +0200 Subject: get permissions directly from share storage to avoid additional db calls --- lib/private/files/cache/permissions.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/private/files/cache/permissions.php b/lib/private/files/cache/permissions.php index eba18af3863..a2a614ca0b1 100644 --- a/lib/private/files/cache/permissions.php +++ b/lib/private/files/cache/permissions.php @@ -14,15 +14,29 @@ class Permissions { */ private $storageId; + /** + * @var \OC\Files\Storage\Storage $storage + */ + protected $storage; + /** * @param \OC\Files\Storage\Storage|string $storage */ public function __construct($storage) { if ($storage instanceof \OC\Files\Storage\Storage) { $this->storageId = $storage->getId(); + $this->storage = $storage; } else { $this->storageId = $storage; + $mountManager = \OC\Files\Filesystem::getMountManager(); + $mount = $mountManager->findByStorageId($this->storageId); + $firstMountPoint = reset($mount); + if ($firstMountPoint instanceof \OC\Files\Storage\Storage) { + $storage = $firstMountPoint->getStorage(); + $this->storage = $storage; + } } + } /** -- cgit v1.2.3