}
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()) {
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;
+ }
+ }
}
$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