diff options
author | Joas Schilling <coding@schilljs.com> | 2021-12-01 21:19:22 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-12-01 21:19:22 +0300 |
commit | 92a29126b297f8192aca49791edebb063d4d33af (patch) | |
tree | 8de24a2af6bae9d3fdb5487c90585368b7cc0491 /lib | |
parent | ee57c974772ac48f177e44a3b84c2bc0bdb6ed70 (diff) |
Reduce filecache hits for Talk/ folder creation
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/TInitialState.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/TInitialState.php b/lib/TInitialState.php index ecf4c2ed6..590ebd94d 100644 --- a/lib/TInitialState.php +++ b/lib/TInitialState.php @@ -28,6 +28,7 @@ use OC\User\NoUserException; use OCP\App\IAppManager; use OCP\AppFramework\Services\IInitialState; use OCP\Files\IRootFolder; +use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\ICacheFactory; use OCP\IConfig; @@ -120,11 +121,13 @@ trait TInitialState { $userFolder = $rootFolder->getUserFolder($user->getUID()); try { - if (!$userFolder->nodeExists($attachmentFolder)) { - $userFolder->newFolder($attachmentFolder); + try { + $folder = $userFolder->get($attachmentFolder); + } catch (NotFoundException $e) { + $folder = $userFolder->newFolder($attachmentFolder); } - $freeSpace = $userFolder->get($attachmentFolder)->getFreeSpace(); + $freeSpace = $folder->getFreeSpace(); } catch (NotPermittedException $e) { $attachmentFolder = '/'; $this->serverConfig->setUserValue($user->getUID(), 'spreed', 'attachment_folder', '/'); |