Skip to content

Commit

Permalink
fix user folder init
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Apr 28, 2022
1 parent de8dd28 commit 9d9973c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/private/Files/Config/UserMountCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function registerMounts(IUser $user, array $mounts, array $mountProviderC
if (is_array($mountProviderClasses)) {
$cachedMounts = array_filter($cachedMounts, function (ICachedMountInfo $mountInfo) use (
$mountProviderClasses
) {
): bool {
return in_array($mountInfo->getMountProvider(), $mountProviderClasses);
});
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public function registerMounts(IUser $user, array $mounts, array $mountProviderC
$this->removeFromCache($mount);
foreach ($mountsForUsers as $index => $mountForUser) {
/** @var ICachedMountInfo $mountForUser */
if ($mount->getRootId() == $mountForUser->getRootId() && $mount->getMountPoint() == $mountForUser->getMountPoint()) {
if ($mount->getRootId() === $mountForUser->getRootId() && $mount->getMountPoint() === $mountForUser->getMountPoint()) {
unset($mountsForUsers[$index]);
break;
}
Expand Down
10 changes: 7 additions & 3 deletions lib/private/Files/ObjectStore/ObjectStoreStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ public function __construct($params) {
if (isset($params['objectPrefix'])) {
$this->objectPrefix = $params['objectPrefix'];
}
//initialize cache with root directory in cache
if (!$this->is_dir('/')) {
$this->mkdir('/');

// home storage is setup in the SetupManager
if (!$this instanceof HomeObjectStoreStorage) {
//initialize cache with root directory in cache
if (!$this->is_dir('/')) {
$this->mkdir('/');
}
}

$this->logger = \OC::$server->getLogger();
Expand Down
6 changes: 4 additions & 2 deletions lib/private/Files/SetupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,10 @@ private function oneTimeUserSetup(IUser $user) {
$this->mountManager->addMount($homeMount);

if ($homeMount->getStorageRootId() === -1) {
$homeMount->getStorage()->mkdir('');
$homeMount->getStorage()->getScanner()->scan('');
$homeStorage = $homeMount->getStorage();
$homeStorage->mkdir('');
$homeStorage->mkdir('files');
$homeStorage->getScanner()->scan('');
}

$provider = $homeMount->getMountProvider();
Expand Down

0 comments on commit 9d9973c

Please sign in to comment.