Skip to content

Commit

Permalink
ensure home storage is initialized on first setup
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and rullzer committed Jul 9, 2020
1 parent 367da7e commit c1beca7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/private/Files/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,10 @@ public static function initMountPoints($user = '') {

// home mounts are handled seperate since we need to ensure this is mounted before we call the other mount providers
$homeMount = $mountConfigManager->getHomeMountForUser($userObject);
if ($homeMount->getStorageRootId() === -1) {
$homeMount->getStorage()->mkdir('');
$homeMount->getStorage()->getScanner()->scan('');
}

self::getMountManager()->addMount($homeMount);

Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Mount/LocalHomeMountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LocalHomeMountProvider implements IHomeMountProvider {
*
* @param IUser $user
* @param IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint[]
* @return \OCP\Files\Mount\IMountPoint|null
*/
public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
$arguments = ['user' => $user];
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Mount/MountPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public function getOptions() {
* @return int
*/
public function getStorageRootId() {
if (is_null($this->rootId)) {
if (is_null($this->rootId) || $this->rootId === -1) {
$this->rootId = (int)$this->getStorage()->getCache()->getId('');
}
return $this->rootId;
Expand Down

0 comments on commit c1beca7

Please sign in to comment.