diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-11-08 22:21:25 +0100 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-11-08 22:21:25 +0100 |
commit | ec015a2e6806be90516e5cba009823050d98bcb0 (patch) | |
tree | 7bfbb31bf4cedba8184996fbe124458552d61059 /lib | |
parent | 878fc1d197e8f1474d2a739da2ddb4c0e7214931 (diff) | |
download | nextcloud-server-ec015a2e6806be90516e5cba009823050d98bcb0.tar.gz nextcloud-server-ec015a2e6806be90516e5cba009823050d98bcb0.zip |
remove the need to register storage providers, pass the classname during mounting instead
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 3 | ||||
-rw-r--r-- | lib/filesystem.php | 47 | ||||
-rw-r--r-- | lib/util.php | 2 |
3 files changed, 8 insertions, 44 deletions
diff --git a/lib/base.php b/lib/base.php index c52b4493e01..2d0bb5fb250 100644 --- a/lib/base.php +++ b/lib/base.php @@ -157,9 +157,6 @@ class OC{ OC_User::useBackend( OC_Config::getValue( "userbackend", "database" )); OC_Group::setBackend( OC_Config::getValue( "groupbackend", "database" )); - // Was in required file ... put it here - OC_Filesystem::registerStorageType('local','OC_Filestorage_Local',array('datadir'=>'string')); - // Set up file system unless forbidden global $RUNTIME_NOSETUPFS; if(!$RUNTIME_NOSETUPFS ){ diff --git a/lib/filesystem.php b/lib/filesystem.php index cae8ead5b16..e28a3c5667e 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -46,35 +46,6 @@ class OC_Filesystem{ static private $storages=array(); static private $mounts=array(); static private $fakeRoot=''; - static private $storageTypes=array(); - - - /** - * register a storage type - * @param string type - * @param string classname - * @param array arguments an associative array in the form of name=>type (eg array('datadir'=>'string')) - */ - static public function registerStorageType($type,$classname,$arguments){ - self::$storageTypes[$type]=array('type'=>$type,'classname'=>$classname,'arguments'=>$arguments); - } - - /** - * check if the filesystem supports a specific storagetype - * @param string type - * @return bool - */ - static public function hasStorageType($type){ - return isset(self::$storageTypes[$type]); - } - - /** - * get the list of names of storagetypes that the filesystem supports - * @return array - */ - static public function getStorageTypeNames(){ - return array_keys(self::$storageTypes); - } /** * tear down the filesystem, removing all storage providers @@ -92,13 +63,9 @@ class OC_Filesystem{ * @param array arguments * @return OC_Filestorage */ - static private function createStorage($type,$arguments){ - if(!self::hasStorageType($type)){ - return false; - } - $className=self::$storageTypes[$type]['classname']; - if(class_exists($className)){ - return new $className($arguments); + static private function createStorage($class,$arguments){ + if(class_exists($class)){ + return new $class($arguments); }else{ return false; } @@ -164,11 +131,11 @@ class OC_Filesystem{ * @param OC_Filestorage storage * @param string mountpoint */ - static public function mount($type,$arguments,$mountpoint){ + static public function mount($class,$arguments,$mountpoint){ if(substr($mountpoint,0,1)!=='/'){ $mountpoint='/'.$mountpoint; } - self::$mounts[$mountpoint]=array('type'=>$type,'arguments'=>$arguments); + self::$mounts[$mountpoint]=array('class'=>$class,'arguments'=>$arguments); } /** @@ -181,7 +148,7 @@ class OC_Filesystem{ if($mountpoint){ if(!isset(self::$storages[$mountpoint])){ $mount=self::$mounts[$mountpoint]; - self::$storages[$mountpoint]=self::createStorage($mount['type'],$mount['arguments']); + self::$storages[$mountpoint]=self::createStorage($mount['class'],$mount['arguments']); } return self::$storages[$mountpoint]; } @@ -285,7 +252,7 @@ class OC_Filesystem{ return self::basicOperation('filemtime',$path); } static public function fileatime($path){ - return self::basicOperation('fileatime',$path); + return self::basicOperation('filemtime',$path); } static public function file_get_contents($path){ return self::basicOperation('file_get_contents',$path,array('read')); diff --git a/lib/util.php b/lib/util.php index 14313569a1d..e010a572e3a 100644 --- a/lib/util.php +++ b/lib/util.php @@ -37,7 +37,7 @@ class OC_Util { if( $user != "" ){ //if we aren't logged in, there is no use to set up the filesystem //first set up the local "root" storage - OC_Filesystem::mount('local',array('datadir'=>$CONFIG_DATADIRECTORY_ROOT),'/'); + OC_Filesystem::mount('OC_Filestorage_Local',array('datadir'=>$CONFIG_DATADIRECTORY_ROOT),'/'); OC::$CONFIG_DATADIRECTORY = $CONFIG_DATADIRECTORY_ROOT."/$user/$root"; if( !is_dir( OC::$CONFIG_DATADIRECTORY )){ |