add OC_Filesystem::resolvePath to get the storage backend and internal path for a file in one go

remotes/origin/stable5
Robin Appelman 2012-09-12 22:53:10 +07:00
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;