From: Robin Appelman Date: Sun, 2 Jun 2013 20:09:44 +0000 (+0200) Subject: make sure the filesystem is setup before doing mount operations X-Git-Tag: v6.0.0alpha2~695^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=38bd234686d206013d1f402c89e310503a65a5a8;p=nextcloud-server.git make sure the filesystem is setup before doing mount operations --- diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php index 7e0bcfd1a27..d3fddf8c421 100644 --- a/lib/files/filesystem.php +++ b/lib/files/filesystem.php @@ -152,6 +152,9 @@ class Filesystem { * @return string */ static public function getMountPoint($path) { + if (!self::$mounts) { + \OC_Util::setupFS(); + } $mount = self::$mounts->find($path); if ($mount) { return $mount->getMountPoint(); @@ -167,6 +170,9 @@ class Filesystem { * @return string[] */ static public function getMountPoints($path) { + if (!self::$mounts) { + \OC_Util::setupFS(); + } $result = array(); $mounts = self::$mounts->findIn($path); foreach ($mounts as $mount) { @@ -182,6 +188,9 @@ class Filesystem { * @return \OC\Files\Storage\Storage */ public static function getStorage($mountPoint) { + if (!self::$mounts) { + \OC_Util::setupFS(); + } $mount = self::$mounts->find($mountPoint); return $mount->getStorage(); } @@ -191,6 +200,9 @@ class Filesystem { * @return Mount\Mount[] */ public static function getMountByStorageId($id) { + if (!self::$mounts) { + \OC_Util::setupFS(); + } return self::$mounts->findByStorageId($id); } @@ -199,6 +211,9 @@ class Filesystem { * @return Mount\Mount[] */ public static function getMountByNumericId($id) { + if (!self::$mounts) { + \OC_Util::setupFS(); + } return self::$mounts->findByNumericId($id); } @@ -209,6 +224,9 @@ class Filesystem { * @return array consisting of the storage and the internal path */ static public function resolvePath($path) { + if (!self::$mounts) { + \OC_Util::setupFS(); + } $mount = self::$mounts->find($path); if ($mount) { return array($mount->getStorage(), $mount->getInternalPath($path)); @@ -223,7 +241,7 @@ class Filesystem { } self::$defaultInstance = new View($root); - if(!self::$mounts) { + if (!self::$mounts) { self::$mounts = new Mount\Manager(); } @@ -235,8 +253,8 @@ class Filesystem { return true; } - static public function initMounts(){ - if(!self::$mounts) { + static public function initMounts() { + if (!self::$mounts) { self::$mounts = new Mount\Manager(); } } @@ -372,6 +390,9 @@ class Filesystem { * @param string $mountpoint */ static public function mount($class, $arguments, $mountpoint) { + if (!self::$mounts) { + \OC_Util::setupFS(); + } $mount = new Mount\Mount($class, $mountpoint, $arguments); self::$mounts->addMount($mount); }