diff options
author | Robin Appelman <robin@icewind.nl> | 2022-03-09 17:23:33 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-03-24 17:01:49 +0100 |
commit | 79f67424108ca0bb159f05370822c0d934dac3b2 (patch) | |
tree | 0838647ec1472b078d099b90a9f33c7a9426e4af /lib/private/Files/Node/Root.php | |
parent | 19c64cf8b6782cf69b8e7330f27580451a8965e7 (diff) | |
download | nextcloud-server-79f67424108ca0bb159f05370822c0d934dac3b2.tar.gz nextcloud-server-79f67424108ca0bb159f05370822c0d934dac3b2.zip |
improve lazy UserFolder
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Node/Root.php')
-rw-r--r-- | lib/private/Files/Node/Root.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php index e8159b23fec..6cb763e2bbf 100644 --- a/lib/private/Files/Node/Root.php +++ b/lib/private/Files/Node/Root.php @@ -381,19 +381,23 @@ class Root extends Folder implements IRootFolder { $userId = $userObject->getUID(); if (!$this->userFolderCache->hasKey($userId)) { - $folder = new LazyFolder(function () use ($userId) { + if ($this->mountManager->getSetupManager()->isSetupComplete($userObject)) { try { - return $this->get('/' . $userId . '/files'); + $folder = $this->get('/' . $userId . '/files'); + if ($folder instanceof \OCP\Files\Folder) { + return $folder; + } else { + throw new \Exception("User folder for $userId exists as a file"); + } } catch (NotFoundException $e) { if (!$this->nodeExists('/' . $userId)) { $this->newFolder('/' . $userId); } return $this->newFolder('/' . $userId . '/files'); } - }, [ - 'path' => '/' . $userId . '/files', - 'permissions' => Constants::PERMISSION_ALL, - ]); + } else { + $folder = new LazyUserFolder($this, $userObject); + } $this->userFolderCache->set($userId, $folder); } |