]> source.dussan.org Git - nextcloud-server.git/commitdiff
make sure the filesystem is setup before doing mount operations
authorRobin Appelman <icewind@owncloud.com>
Sun, 2 Jun 2013 20:09:44 +0000 (22:09 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sun, 2 Jun 2013 20:09:44 +0000 (22:09 +0200)
lib/files/filesystem.php

index 7e0bcfd1a27b76ff6751713751366abd3d07827e..d3fddf8c421ba73f19e0d172acef4e6cf15ff669 100644 (file)
@@ -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);
        }