make objectstore setup more robust, don't pass user to object store mounted as root

This commit is contained in:
Jörn Friedrich Dreyer 2014-06-10 18:15:07 +02:00
parent 3c66a8c8ed
commit 2bf7e5c02f
1 changed files with 7 additions and 5 deletions

View File

@ -74,7 +74,7 @@ class OC_Util {
//check if we are using an object storage
$object_storage = OC_Config::getValue( 'object_storage' );
if ( isset( $object_storage ) ) {
if ( isset( $object_storage ) && OC_App::isEnabled('objectstore') ) {
self::initObjectStorageRootFS($object_storage);
} else {
self::initLocalStorageRootFS();
@ -96,10 +96,12 @@ class OC_Util {
if ($storage->instanceOfStorage('\OC\Files\Storage\Home')
|| $storage->instanceOfStorage('\OCA\ObjectStore\AbstractObjectStore') // FIXME introduce interface \OC\Files\Storage\HomeStorage? or add method?
) {
$user = $storage->getUser()->getUID();
$quota = OC_Util::getUserQuota($user);
if ($quota !== \OC\Files\SPACE_UNLIMITED) {
return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota, 'root' => 'files'));
if (is_object($storage->getUser())) {
$user = $storage->getUser()->getUID();
$quota = OC_Util::getUserQuota($user);
if ($quota !== \OC\Files\SPACE_UNLIMITED) {
return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota, 'root' => 'files'));
}
}
}