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
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-08-25 16:50:02 +0300
committerRobin Appelman <robin@icewind.nl>2016-08-25 18:22:25 +0300
commitfb88d668575562407edcaf392ec6f771cba55dba (patch)
tree9ab7353642d7e1082093c0dc85b0072296d2f31a /lib
parent2693ae870eff6a6aec769c035c200f0b5caf4e6f (diff)
optimize getUserFolder for the common case
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Node/Root.php17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index e5921206a39..007847fb513 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -341,22 +341,17 @@ class Root extends Folder implements IRootFolder {
public function getUserFolder($userId) {
if (!$this->userFolderCache->hasKey($userId)) {
\OC\Files\Filesystem::initMountPoints($userId);
- $dir = '/' . $userId;
- $folder = null;
try {
- $folder = $this->get($dir);
+ $folder = $this->get('/' . $userId . '/files');
} catch (NotFoundException $e) {
- $folder = $this->newFolder($dir);
- }
-
- $dir = '/files';
- try {
- $folder = $folder->get($dir);
- } catch (NotFoundException $e) {
- $folder = $folder->newFolder($dir);
+ if (!$this->nodeExists('/' . $userId)) {
+ $this->newFolder('/' . $userId);
+ }
+ $folder = $this->newFolder('/' . $userId . '/files');
\OC_Util::copySkeleton($userId, $folder);
}
+
$this->userFolderCache->set($userId, $folder);
}