Browse Source

fix unit test by always initializing the root of the storage in the constructor

tags/v7.0.0RC1
Jörn Friedrich Dreyer 10 years ago
parent
commit
7493ff0624

+ 12
- 8
lib/private/files/objectstore/abstractobjectstore.php View File

@@ -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);


+ 2
- 11
lib/private/util.php View File

@@ -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 )) {

+ 0
- 1
tests/lib/files/objectstore/swift.php View File

@@ -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();

Loading…
Cancel
Save