From c1beca75fe6737c1595b2d68a67c366732e02ece Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 8 Jul 2020 13:58:27 +0200 Subject: [PATCH] ensure home storage is initialized on first setup Signed-off-by: Robin Appelman --- lib/private/Files/Filesystem.php | 4 ++++ lib/private/Files/Mount/LocalHomeMountProvider.php | 2 +- lib/private/Files/Mount/MountPoint.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index d3c4e1afc62a2..9d534815cdc08 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -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); diff --git a/lib/private/Files/Mount/LocalHomeMountProvider.php b/lib/private/Files/Mount/LocalHomeMountProvider.php index 744a57981e2f6..68c69cc8cdc2f 100644 --- a/lib/private/Files/Mount/LocalHomeMountProvider.php +++ b/lib/private/Files/Mount/LocalHomeMountProvider.php @@ -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]; diff --git a/lib/private/Files/Mount/MountPoint.php b/lib/private/Files/Mount/MountPoint.php index 2cb25f07044b5..f9cda6fbce8e1 100644 --- a/lib/private/Files/Mount/MountPoint.php +++ b/lib/private/Files/Mount/MountPoint.php @@ -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;