Merge pull request #822 from nextcloud/shared-storage-lazy-numeric-id-10

[10] get shared storage storage id without setting up the storage
This commit is contained in:
Lukas Reschke 2016-08-10 16:03:21 +02:00 committed by GitHub
commit 5e7973b869
4 changed files with 29 additions and 5 deletions

View File

@ -235,4 +235,17 @@ class SharedMount extends MountPoint implements MoveableMount {
public function getStorageRootId() {
return $this->getShare()->getNodeId();
}
/**
* @return int
*/
public function getNumericStorageId() {
$builder = \OC::$server->getDatabaseConnection()->getQueryBuilder();
$query = $builder->select('storage')
->from('filecache')
->where($builder->expr()->eq('fileid', $builder->createNamedParameter($this->getShare()->getNodeId())));
return $query->execute()->fetchColumn();
}
}

View File

@ -48,11 +48,7 @@ class LazyStorageMountInfo extends CachedMountInfo {
*/
public function getStorageId() {
if (!$this->storageId) {
$storage = $this->mount->getStorage();
if (!$storage) {
return -1;
}
$this->storageId = $storage->getStorageCache()->getNumericId();
$this->storageId = $this->mount->getNumericStorageId();
}
return parent::getStorageId();
}

View File

@ -191,6 +191,13 @@ class MountPoint implements IMountPoint {
return $this->storageId;
}
/**
* @return int
*/
public function getNumericStorageId() {
return $this->getStorage()->getStorageCache()->getNumericId();
}
/**
* @param string $path
* @return string

View File

@ -61,6 +61,14 @@ interface IMountPoint {
*/
public function getStorageId();
/**
* Get the id of the storages
*
* @return int
* @since 9.1.0
*/
public function getNumericStorageId();
/**
* Get the path relative to the mountpoint
*