diff --git a/apps/files_sharing/lib/SharedMount.php b/apps/files_sharing/lib/SharedMount.php index 3f5bf8ea7bff..3030e206a18e 100644 --- a/apps/files_sharing/lib/SharedMount.php +++ b/apps/files_sharing/lib/SharedMount.php @@ -233,4 +233,13 @@ public function getShare() { public function getStorageRootId() { return $this->getShare()->getNodeId(); } + + public function getStorageNumericId() { + $query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + $query->select('storage') + ->from('filecache') + ->where($query->expr()->eq('fileid', $query->createNamedParameter($this->share->getNodeId()))); + + return $query->execute()->fetchColumn(); + } } diff --git a/lib/private/Files/Config/LazyStorageMountInfo.php b/lib/private/Files/Config/LazyStorageMountInfo.php index 5df04c4b78ea..3af6a7fddb4f 100644 --- a/lib/private/Files/Config/LazyStorageMountInfo.php +++ b/lib/private/Files/Config/LazyStorageMountInfo.php @@ -47,11 +47,15 @@ public function __construct(IUser $user, IMountPoint $mount) { */ public function getStorageId() { if (!$this->storageId) { - $storage = $this->mount->getStorage(); - if (!$storage) { - return -1; + if (method_exists($this->mount, 'getStorageNumericId')) { + $this->storageId = $this->mount->getStorageNumericId(); + } else { + $storage = $this->mount->getStorage(); + if (!$storage) { + return -1; + } + $this->storageId = $storage->getStorageCache()->getNumericId(); } - $this->storageId = $storage->getStorageCache()->getNumericId(); } return parent::getStorageId(); }