mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 23:03:00 -04:00
add OC_Filesystem::resolvePath to get the storage backend and internal path for a file in one go
This commit is contained in:
parent
e8d3a47685
commit
68f65b657c
1 changed files with 18 additions and 0 deletions
|
|
@ -194,6 +194,24 @@ class OC_Filesystem{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* resolve a path to a storage and internal path
|
||||
* @param string $path
|
||||
* @return array consisting of the storage and the internal path
|
||||
*/
|
||||
static public function resolvePath($path){
|
||||
$mountpoint=self::getMountPoint($path);
|
||||
if($mountpoint) {
|
||||
if(!isset(OC_Filesystem::$storages[$mountpoint])) {
|
||||
$mount=OC_Filesystem::$mounts[$mountpoint];
|
||||
OC_Filesystem::$storages[$mountpoint]=OC_Filesystem::createStorage($mount['class'],$mount['arguments']);
|
||||
}
|
||||
$storage = OC_Filesystem::$storages[$mountpoint];
|
||||
$internalPath=substr($path,strlen($mountpoint));
|
||||
return array($storage, $internalPath);
|
||||
}
|
||||
}
|
||||
|
||||
static public function init($root) {
|
||||
if(self::$defaultInstance) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue