throw exception when backends don't provide a user instead of creating legacy local storages
This commit is contained in:
parent
5626a02d69
commit
b069f33a72
|
@ -373,41 +373,41 @@ class Filesystem {
|
||||||
|
|
||||||
$userObject = \OC_User::getManager()->get($user);
|
$userObject = \OC_User::getManager()->get($user);
|
||||||
|
|
||||||
if (!is_null($userObject)) {
|
if (is_null($userObject)) {
|
||||||
$homeStorage = \OC_Config::getValue( 'objectstore' );
|
\OCP\Util::writeLog('files', ' Backends provided no user object for '.$user, \OCP\Util::ERROR);
|
||||||
if (!empty($homeStorage)) {
|
throw new \OC\User\NoUserException();
|
||||||
// sanity checks
|
|
||||||
if (empty($homeStorage['class'])) {
|
|
||||||
\OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
|
|
||||||
}
|
|
||||||
if (!isset($homeStorage['arguments'])) {
|
|
||||||
$homeStorage['arguments'] = array();
|
|
||||||
}
|
|
||||||
// instantiate object store implementation
|
|
||||||
$homeStorage['arguments']['objectstore'] = new $homeStorage['class']($homeStorage['arguments']);
|
|
||||||
// mount with home object store implementation
|
|
||||||
$homeStorage['class'] = '\OC\Files\ObjectStore\HomeObjectStoreStorage';
|
|
||||||
} else {
|
|
||||||
$homeStorage = array(
|
|
||||||
//default home storage configuration:
|
|
||||||
'class' => '\OC\Files\Storage\Home',
|
|
||||||
'arguments' => array()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$homeStorage['arguments']['user'] = $userObject;
|
|
||||||
|
|
||||||
// check for legacy home id (<= 5.0.12)
|
|
||||||
if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) {
|
|
||||||
$homeStorage['arguments']['legacy'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
self::mount($homeStorage['class'], $homeStorage['arguments'], $user);
|
|
||||||
|
|
||||||
$home = \OC\Files\Filesystem::getStorage($user);
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user);
|
$homeStorage = \OC_Config::getValue( 'objectstore' );
|
||||||
|
if (!empty($homeStorage)) {
|
||||||
|
// sanity checks
|
||||||
|
if (empty($homeStorage['class'])) {
|
||||||
|
\OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
|
||||||
|
}
|
||||||
|
if (!isset($homeStorage['arguments'])) {
|
||||||
|
$homeStorage['arguments'] = array();
|
||||||
|
}
|
||||||
|
// instantiate object store implementation
|
||||||
|
$homeStorage['arguments']['objectstore'] = new $homeStorage['class']($homeStorage['arguments']);
|
||||||
|
// mount with home object store implementation
|
||||||
|
$homeStorage['class'] = '\OC\Files\ObjectStore\HomeObjectStoreStorage';
|
||||||
|
} else {
|
||||||
|
$homeStorage = array(
|
||||||
|
//default home storage configuration:
|
||||||
|
'class' => '\OC\Files\Storage\Home',
|
||||||
|
'arguments' => array()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
$homeStorage['arguments']['user'] = $userObject;
|
||||||
|
|
||||||
|
// check for legacy home id (<= 5.0.12)
|
||||||
|
if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) {
|
||||||
|
$homeStorage['arguments']['legacy'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::mount($homeStorage['class'], $homeStorage['arguments'], $user);
|
||||||
|
|
||||||
|
$home = \OC\Files\Filesystem::getStorage($user);
|
||||||
|
|
||||||
self::mountCacheDir($user);
|
self::mountCacheDir($user);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ownCloud
|
||||||
|
*
|
||||||
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
|
* later. See the COPYING-AGPL file.
|
||||||
|
*
|
||||||
|
* @author Jörn Friedrich Dreyer <jfd@owncloud.com>
|
||||||
|
* @copyright Jörn Friedrich Dreyer 2015
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OC\User;
|
||||||
|
|
||||||
|
class NoUserException extends \Exception {}
|
Loading…
Reference in New Issue