]> source.dussan.org Git - nextcloud-server.git/commitdiff
use the new home storage backend when no existing local storage backend exists for...
authorRobin Appelman <icewind@owncloud.com>
Mon, 28 Oct 2013 23:26:35 +0000 (00:26 +0100)
committerRobin Appelman <icewind@owncloud.com>
Mon, 28 Oct 2013 23:26:35 +0000 (00:26 +0100)
lib/private/files/cache/storage.php
lib/private/files/filesystem.php

index 8a9e47ca36d62422b4d7db3a5bb959c03d4fef7c..5657cf06e12115a5b6b28e4e7de24dea32e055ee 100644 (file)
@@ -48,7 +48,7 @@ class Storage {
        }
 
        public static function getStorageId($numericId) {
-               
+
                $sql = 'SELECT `id` FROM `*PREFIX*storages` WHERE `numeric_id` = ?';
                $result = \OC_DB::executeAudited($sql, array($numericId));
                if ($row = $result->fetchRow()) {
@@ -57,4 +57,17 @@ class Storage {
                        return null;
                }
        }
+
+       public static function exists($storageId) {
+               if (strlen($storageId) > 64) {
+                       $storageId = md5($storageId);
+               }
+               $sql = 'SELECT `numeric_id` FROM `*PREFIX*storages` WHERE `id` = ?';
+               $result = \OC_DB::executeAudited($sql, array($storageId));
+               if ($row = $result->fetchRow()) {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
 }
index 10ec5c41d11eb97525bc96d42cb74b49cf79c87c..beed38310819863e0fe50c6f480bdb2fc9875cf5 100644 (file)
@@ -305,7 +305,13 @@ class Filesystem {
                $parser = new \OC\ArrayParser();
 
                $root = \OC_User::getHome($user);
-               self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user);
+
+               if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) {
+                       self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user);
+               } else {
+                       $userObject = \OC_User::getManager()->get($user);
+                       self::mount('\OC\Files\Storage\Home', array('user' => $userObject), $user);
+               }
                $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data");
 
                //move config file to it's new position