From 7493ff062410093eca753780b7d226c63427d274 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 13 Jun 2014 15:05:54 +0200 Subject: [PATCH] fix unit test by always initializing the root of the storage in the constructor --- .../files/objectstore/abstractobjectstore.php | 20 +++++++++++-------- lib/private/util.php | 13 ++---------- tests/lib/files/objectstore/swift.php | 1 - 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/lib/private/files/objectstore/abstractobjectstore.php b/lib/private/files/objectstore/abstractobjectstore.php index 3f67ad9a494..db4c398018e 100644 --- a/lib/private/files/objectstore/abstractobjectstore.php +++ b/lib/private/files/objectstore/abstractobjectstore.php @@ -57,6 +57,18 @@ abstract class AbstractObjectStore extends \OC\Files\Storage\Common { */ private static $tmpFiles = array(); + public function __construct($params) { + if (isset($params['user']) && is_object($params['user'])) { + $this->user = $params['user']; + } else { + $this->user = null; + } + //initialize cache with root directory in cache + if ( ! $this->is_dir('/') ) { + $this->mkdir('/'); + } + } + /** * @param string $path * @return \OC\Files\Cache\Cache @@ -125,14 +137,6 @@ abstract class AbstractObjectStore extends \OC\Files\Storage\Common { return 'objstore::root'; } - public function __construct($params) { - if (isset($params['user']) && is_object($params['user'])) { - $this->user = $params['user']; - } else { - $this->user = null; - } - } - public function mkdir($path) { $path = $this->normalizePath($path); diff --git a/lib/private/util.php b/lib/private/util.php index 435a2914555..b4772f14960 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -110,17 +110,8 @@ class OC_Util { $userDir = '/'.$user.'/files'; - //autocreate users "home" directory - if ( isset( $root_storage ) ) { - $root = \OC\Files\Filesystem::getStorage('/'); - if ( $root->instanceOfStorage('\OC\Files\ObjectStore\AbstractObjectStore') ) { - //initialize cache with root directory in cache - if ( ! $root->is_dir('/') ) { - $root->mkdir('/'); - } - } - } else { - //copy skeleton for local storage only + // copy skeleton for local storage only + if ( ! isset( $root_storage ) ) { $userRoot = OC_User::getHome($user); $userDirectory = $userRoot . '/files'; if( !is_dir( $userDirectory )) { diff --git a/tests/lib/files/objectstore/swift.php b/tests/lib/files/objectstore/swift.php index 7687818f43d..1e7495e0a22 100644 --- a/tests/lib/files/objectstore/swift.php +++ b/tests/lib/files/objectstore/swift.php @@ -35,7 +35,6 @@ class Swift extends PHPUnit_Framework_TestCase { \OC_App::disable('files_sharing'); \OC_App::disable('files_versions'); - \OC_App::enable('objectstore'); // reset backend \OC_User::clearBackends(); -- 2.39.5