Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-03-08 18:20:05 +0300
committerRobin Appelman <robin@icewind.nl>2022-03-24 19:01:08 +0300
commit3fc5c97282cf1d2ab29eb916a04a0d660825e51b (patch)
treec899c50f4961550d734979c606530421eab31fe6 /lib/private/Files
parent46d0eef8da5bf0f9fc9719e9727e6c36553d24a1 (diff)
return a lazy folder from Root::getUserFolder
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Node/Root.php22
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);
}