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

This commit is contained in:
Jörn Friedrich Dreyer 2014-06-13 13:26:09 +02:00
parent 652af71ba9
commit 10de4a7b90
3 changed files with 19 additions and 13 deletions

View File

@ -343,6 +343,14 @@ class Filesystem {
$homeStorage['arguments']['legacy'] = true; $homeStorage['arguments']['legacy'] = true;
} }
self::mount($homeStorage['class'], $homeStorage['arguments'], $user); 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 { else {
self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user); self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user);

View File

@ -131,17 +131,6 @@ abstract class AbstractObjectStore extends \OC\Files\Storage\Common {
} else { } else {
$this->user = null; $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) { public function mkdir($path) {

View File

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