From 2a5ee9512ee88da53dcba862a32279bdc7096bfb Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 12 Jun 2011 00:57:43 +0200 Subject: allow tear down of filesystem. also fix a bug when chrooting to '/' --- lib/filesystem.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib/filesystem.php') diff --git a/lib/filesystem.php b/lib/filesystem.php index 2b5c3a56b6e..27a937f5e4c 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -67,6 +67,16 @@ class OC_FILESYSTEM{ return array_keys(self::$storageTypes); } + /** + * tear down the filesystem, removing all storage providers + */ + static public function tearDown(){ + foreach(self::$storages as $mountpoint=>$storage){ + unset(self::$storages[$mountpoint]); + } + $fakeRoot=''; + } + /** * create a new storage of a specific type * @param string type @@ -91,8 +101,10 @@ class OC_FILESYSTEM{ * @return bool */ static public function chroot($fakeRoot){ - if($fakeRoot[0]!=='/'){ - $fakeRoot='/'.$fakeRoot; + if(!$fakeRoot==''){ + if($fakeRoot[0]!=='/'){ + $fakeRoot='/'.$fakeRoot; + } } self::$fakeRoot=$fakeRoot; } -- cgit v1.2.3