diff options
author | Robin Appelman <robin@icewind.nl> | 2022-03-08 16:20:05 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-03-24 17:01:08 +0100 |
commit | 3fc5c97282cf1d2ab29eb916a04a0d660825e51b (patch) | |
tree | c899c50f4961550d734979c606530421eab31fe6 /lib | |
parent | 46d0eef8da5bf0f9fc9719e9727e6c36553d24a1 (diff) | |
download | nextcloud-server-3fc5c97282cf1d2ab29eb916a04a0d660825e51b.tar.gz nextcloud-server-3fc5c97282cf1d2ab29eb916a04a0d660825e51b.zip |
return a lazy folder from Root::getUserFolder
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Node/Root.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php index 88ac4a31d34..e8159b23fec 100644 --- a/lib/private/Files/Node/Root.php +++ b/lib/private/Files/Node/Root.php @@ -38,6 +38,7 @@ use OC\Files\Mount\MountPoint; use OC\Files\View; use OC\Hooks\PublicEmitter; use OC\User\NoUserException; +use OCP\Constants; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Config\IUserMountCache; use OCP\Files\Events\Node\FilesystemTornDownEvent; @@ -380,16 +381,19 @@ class Root extends Folder implements IRootFolder { $userId = $userObject->getUID(); if (!$this->userFolderCache->hasKey($userId)) { - \OC\Files\Filesystem::initMountPoints($userId); - - try { - $folder = $this->get('/' . $userId . '/files'); - } catch (NotFoundException $e) { - if (!$this->nodeExists('/' . $userId)) { - $this->newFolder('/' . $userId); + $folder = new LazyFolder(function () use ($userId) { + try { + return $this->get('/' . $userId . '/files'); + } catch (NotFoundException $e) { + if (!$this->nodeExists('/' . $userId)) { + $this->newFolder('/' . $userId); + } + return $this->newFolder('/' . $userId . '/files'); } - $folder = $this->newFolder('/' . $userId . '/files'); - } + }, [ + 'path' => '/' . $userId . '/files', + 'permissions' => Constants::PERMISSION_ALL, + ]); $this->userFolderCache->set($userId, $folder); } |