]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: fix user folder init 32163/head
authorRobin Appelman <robin@icewind.nl>
Thu, 28 Apr 2022 13:39:01 +0000 (15:39 +0200)
committerRobin Appelman <robin@icewind.nl>
Wed, 6 Mar 2024 16:52:24 +0000 (17:52 +0100)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Config/UserMountCache.php
lib/private/Files/ObjectStore/ObjectStoreStorage.php
lib/private/Files/SetupManager.php

index 27d84e938383119c3a58ee985d82aa4a95b25c73..13908c8725e18b707fb5bfecdc8ffb0cc6248fd2 100644 (file)
@@ -94,7 +94,7 @@ class UserMountCache implements IUserMountCache {
 
                $cachedMounts = $this->getMountsForUser($user);
                if (is_array($mountProviderClasses)) {
-                       $cachedMounts = array_filter($cachedMounts, function (ICachedMountInfo $mountInfo) use ($mountProviderClasses, $newMounts) {
+                       $cachedMounts = array_filter($cachedMounts, function (ICachedMountInfo $mountInfo) use ($mountProviderClasses, $newMounts): bool {
                                // for existing mounts that didn't have a mount provider set
                                // we still want the ones that map to new mounts
                                if ($mountInfo->getMountProvider() === '' && isset($newMounts[$mountInfo->getKey()])) {
index 7eb284fc7746391555597b837f2a88bb69a85985..3ef13f0ab01b6e1007a24729958ae270c69a9702 100644 (file)
@@ -82,6 +82,14 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
                if (isset($params['validateWrites'])) {
                        $this->validateWrites = (bool)$params['validateWrites'];
                }
+
+               // 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->handleCopiesAsOwned = (bool)($params['handleCopiesAsOwned'] ?? false);
 
                $this->logger = \OCP\Server::get(LoggerInterface::class);
index db4debfb83fd8ef2497416a709c2a2d2d9f55f10..accb071a814990e464b886e2e9e638a84e38afef 100644 (file)
@@ -257,8 +257,10 @@ class SetupManager {
 
                        if ($homeMount->getStorageRootId() === -1) {
                                $this->eventLogger->start('fs:setup:user:home:scan', 'Scan home filesystem for user');
-                               $homeMount->getStorage()->mkdir('');
-                               $homeMount->getStorage()->getScanner()->scan('');
+                               $homeStorage = $homeMount->getStorage();
+                               $homeStorage->mkdir('');
+                               $homeStorage->mkdir('files');
+                               $homeStorage->getScanner()->scan('');
                                $this->eventLogger->end('fs:setup:user:home:scan');
                        }