[Pkg-owncloud-commits] [owncloud] 18/273: fix unit test by always initializing the root of the storage in the constructor
David Prévot
taffit at moszumanska.debian.org
Fri Jul 4 03:12:53 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 7493ff062410093eca753780b7d226c63427d274
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date: Fri Jun 13 15:05:54 2014 +0200
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 3f67ad9..db4c398 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 435a291..b4772f1 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 7687818..1e7495e 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();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list