Browse Source

move creation of / and users 'files' from storage constructor to setupFS / mount initialization

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

+ 8
- 0
lib/private/files/filesystem.php View File

@@ -343,6 +343,14 @@ class Filesystem {
$homeStorage['arguments']['legacy'] = true;
}
self::mount($homeStorage['class'], $homeStorage['arguments'], $user);

$home = \OC\Files\Filesystem::getStorage($user);
if ( $home->instanceOfStorage('\OC\Files\ObjectStore\AbstractObjectStore') ) {
//create the files folder in the cache when mounting the objectstore for a user
if ( ! $home->is_dir('files') ) {
$home->mkdir('files');
}
}
}
else {
self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user);

+ 0
- 11
lib/private/files/objectstore/abstractobjectstore.php View File

@@ -131,17 +131,6 @@ abstract class AbstractObjectStore extends \OC\Files\Storage\Common {
} else {
$this->user = null;
}
//initialize cache with root directory in cache
if ( ! $this->is_dir('/') ) {
$this->mkdir('/');
}

if (isset($params['user']) && is_object($params['user'])) {
//create the files folder in the cache when mounting the objectstore for a user
if ( ! $this->is_dir('files') ) {
$this->mkdir('files');
}
}
}

public function mkdir($path) {

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

@@ -110,8 +110,17 @@ class OC_Util {

$userDir = '/'.$user.'/files';

//autocreate users "home" directory for local storage only
if ( ! isset( $root_storage ) ) {
//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
$userRoot = OC_User::getHome($user);
$userDirectory = $userRoot . '/files';
if( !is_dir( $userDirectory )) {

Loading…
Cancel
Save