summaryrefslogtreecommitdiffstats
path: root/lib/filesystem.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-10-18 21:01:49 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-10-18 21:01:49 +0200
commit28ab39073a8ea942a7c299dc41ddf6023dd093de (patch)
tree48be9c392788c2eee61e08e5330e2cf5881958f7 /lib/filesystem.php
parent59eac3bc29426b4871b03e9d173467e7b8059501 (diff)
downloadnextcloud-server-28ab39073a8ea942a7c299dc41ddf6023dd093de.tar.gz
nextcloud-server-28ab39073a8ea942a7c299dc41ddf6023dd093de.zip
mount filesystems on demand
Diffstat (limited to 'lib/filesystem.php')
-rw-r--r--lib/filesystem.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/filesystem.php b/lib/filesystem.php
index f84cda20eac..60fd051f303 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -44,6 +44,7 @@
*/
class OC_Filesystem{
static private $storages=array();
+ static private $mounts=array();
static private $fakeRoot='';
static private $storageTypes=array();
@@ -91,7 +92,7 @@ class OC_Filesystem{
* @param array arguments
* @return OC_Filestorage
*/
- static public function createStorage($type,$arguments){
+ static private function createStorage($type,$arguments){
if(!self::hasStorageType($type)){
return false;
}
@@ -163,11 +164,11 @@ class OC_Filesystem{
* @param OC_Filestorage storage
* @param string mountpoint
*/
- static public function mount($storage,$mountpoint){
+ static public function mount($type,$arguments,$mountpoint){
if(substr($mountpoint,0,1)!=='/'){
$mountpoint='/'.$mountpoint;
}
- self::$storages[self::$fakeRoot.$mountpoint]=$storage;
+ self::$mounts[self::$fakeRoot.$mountpoint]=array('type'=>$type,'arguments'=>$arguments);
}
/**
@@ -178,6 +179,10 @@ class OC_Filesystem{
static public function getStorage($path){
$mountpoint=self::getMountPoint($path);
if($mountpoint){
+ if(!isset(self::$storages[$mountpoint])){
+ $mount=self::$mounts[$mountpoint];
+ self::$storages[$mountpoint]=self::createStorage($mount['type'],$mount['arguments']);
+ }
return self::$storages[$mountpoint];
}
}
@@ -201,7 +206,7 @@ class OC_Filesystem{
}
$path=self::$fakeRoot.$path;
$foundMountPoint='';
- foreach(self::$storages as $mountpoint=>$storage){
+ foreach(self::$mounts as $mountpoint=>$storage){
if(substr($mountpoint,-1)!=='/'){
$mountpoint=$mountpoint.'/';
}