diff options
author | Robin Appelman <robin@icewind.nl> | 2016-08-25 15:50:02 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2016-08-25 17:22:25 +0200 |
commit | fb88d668575562407edcaf392ec6f771cba55dba (patch) | |
tree | 9ab7353642d7e1082093c0dc85b0072296d2f31a /lib/private/Files/Node/Root.php | |
parent | 2693ae870eff6a6aec769c035c200f0b5caf4e6f (diff) | |
download | nextcloud-server-fb88d668575562407edcaf392ec6f771cba55dba.tar.gz nextcloud-server-fb88d668575562407edcaf392ec6f771cba55dba.zip |
optimize getUserFolder for the common case
Diffstat (limited to 'lib/private/Files/Node/Root.php')
-rw-r--r-- | lib/private/Files/Node/Root.php | 17 |
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); } |