]> source.dussan.org Git - nextcloud-server.git/commitdiff
make objectstore setup more robust, don't pass user to object store mounted as root
authorJörn Friedrich Dreyer <jfd@butonic.de>
Tue, 10 Jun 2014 16:15:07 +0000 (18:15 +0200)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Wed, 18 Jun 2014 10:53:19 +0000 (12:53 +0200)
lib/private/util.php

index 5e019bf90b6b92142bc1df230adc4f7033912104..bb76b42384324421fe2f6afaf6be13145a356bbf 100755 (executable)
@@ -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'));
+                                               }
                                        }
                                }