summaryrefslogtreecommitdiffstats
path: root/inc/lib_filesystem.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2010-09-06 20:02:17 +0200
committerRobin Appelman <icewind1991@gmail.com>2010-09-06 20:02:17 +0200
commit5162809c8afd722a00de90390f94e173cac8431a (patch)
tree10831f5d104831dd236d9e0094fca07af8bb9a23 /inc/lib_filesystem.php
parentb479f9d570054bc5630a600d9321444216e2e4a2 (diff)
downloadnextcloud-server-5162809c8afd722a00de90390f94e173cac8431a.tar.gz
nextcloud-server-5162809c8afd722a00de90390f94e173cac8431a.zip
make the filesystem configurable (no gui yet)
Diffstat (limited to 'inc/lib_filesystem.php')
-rw-r--r--inc/lib_filesystem.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/inc/lib_filesystem.php b/inc/lib_filesystem.php
index 3a2373f166b..263b1d7a419 100644
--- a/inc/lib_filesystem.php
+++ b/inc/lib_filesystem.php
@@ -30,6 +30,53 @@
class OC_FILESYSTEM{
static private $storages=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);
+ }
+
+ /**
+ * create a new storage of a specific type
+ * @param string type
+ * @param array arguments
+ * @return OC_FILESTORAGE
+ */
+ static public function createStorage($type,$arguments){
+ if(!self::hasStorageType($type)){
+ return false;
+ }
+ $className=self::$storageTypes[$type]['classname'];
+ if(class_exists($className)){
+ return new $className($arguments);
+ }else{
+ return false;
+ }
+ }
/**
* change the root to a fake toor