From bd675124096707a925faac2774516975ec7049c1 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 7 Jun 2013 17:07:13 +0200 Subject: manage creating and wrapping storages in it's own class --- lib/files/filesystem.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib/files/filesystem.php') diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php index eadd8a93faf..ce89c5c23ff 100644 --- a/lib/files/filesystem.php +++ b/lib/files/filesystem.php @@ -30,6 +30,7 @@ namespace OC\Files; +use OC\Files\Storage\Loader; const FREE_SPACE_UNKNOWN = -2; const FREE_SPACE_UNLIMITED = -3; @@ -142,6 +143,11 @@ class Filesystem { */ const signal_param_run = 'run'; + /** + * @var \OC\Files\Storage\Loader $loader + */ + private static $loader; + /** * get the mountpoint of the storage object for a path * ( note: because a storage is not always mounted inside the fakeroot, the @@ -221,6 +227,7 @@ class Filesystem { if (self::$defaultInstance) { return false; } + self::$loader = new Loader(); self::$defaultInstance = new View($root); self::$mounts = new Mount\Manager(); @@ -232,7 +239,7 @@ class Filesystem { return true; } - static public function initMounts(){ + static public function initMounts() { self::$mounts = new Mount\Manager(); } @@ -365,7 +372,7 @@ class Filesystem { * @param string $mountpoint */ static public function mount($class, $arguments, $mountpoint) { - $mount = new Mount\Mount($class, $mountpoint, $arguments); + $mount = new Mount\Mount($class, $mountpoint, $arguments, self::$loader); self::$mounts->addMount($mount); } -- cgit v1.2.3 From 2708ab09abf12321df97ed730a83c328d2b360fc Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 7 Jun 2013 17:40:19 +0200 Subject: storage loader needs to be accessible by apps --- lib/files/filesystem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/files/filesystem.php') diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php index 0daa863e79d..a7b1da57c1a 100644 --- a/lib/files/filesystem.php +++ b/lib/files/filesystem.php @@ -146,7 +146,7 @@ class Filesystem { /** * @var \OC\Files\Storage\Loader $loader */ - private static $loader; + public static $loader; /** * get the mountpoint of the storage object for a path -- cgit v1.2.3 From 94ca576c9ac30b7e5878c108a5efe2cad16faa94 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 7 Jun 2013 17:50:10 +0200 Subject: use a getter for the storage loader to ensure the instance is created --- lib/files/filesystem.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/files/filesystem.php') diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php index a7b1da57c1a..3d7d5abf8fe 100644 --- a/lib/files/filesystem.php +++ b/lib/files/filesystem.php @@ -146,7 +146,14 @@ class Filesystem { /** * @var \OC\Files\Storage\Loader $loader */ - public static $loader; + private static $loader; + + public static function getLoader(){ + if (!self::$loader) { + self::$loader = new Loader(); + } + return self::$loader; + } /** * get the mountpoint of the storage object for a path @@ -245,7 +252,7 @@ class Filesystem { if (self::$defaultInstance) { return false; } - self::$loader = new Loader(); + self::getLoader(); self::$defaultInstance = new View($root); if (!self::$mounts) { @@ -400,7 +407,7 @@ class Filesystem { if (!self::$mounts) { \OC_Util::setupFS(); } - $mount = new Mount\Mount($class, $mountpoint, $arguments, self::$loader); + $mount = new Mount\Mount($class, $mountpoint, $arguments, self::getLoader()); self::$mounts->addMount($mount); } -- cgit v1.2.3