summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2014-06-13 15:05:54 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2014-06-18 12:53:20 +0200
commit7493ff062410093eca753780b7d226c63427d274 (patch)
treef3a13e1cf447517446cf724fbdb3fd5fa4d2132e /lib/private
parentc18836c8ae42d5a334baea228b7e792098a02089 (diff)
downloadnextcloud-server-7493ff062410093eca753780b7d226c63427d274.tar.gz
nextcloud-server-7493ff062410093eca753780b7d226c63427d274.zip
fix unit test by always initializing the root of the storage in the constructor
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/files/objectstore/abstractobjectstore.php20
-rwxr-xr-xlib/private/util.php13
2 files changed, 14 insertions, 19 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 )) {