get shared storage storage id without setting up the storage

This commit is contained in:
Robin Appelman 2016-08-09 15:52:13 +02:00
parent 5d11b5b278
commit 5321a8728e
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
*