diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-12-11 16:22:26 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-12-11 16:22:26 +0100 |
commit | 366d75e9479b1ac2b52b6a37389a4aa107b059e3 (patch) | |
tree | 10405558d717e0978c227cfde4983419b07f53c6 /lib/private/user/user.php | |
parent | 050f87c9e42061b7994ae1c32918a691141f63be (diff) | |
download | nextcloud-server-366d75e9479b1ac2b52b6a37389a4aa107b059e3.tar.gz nextcloud-server-366d75e9479b1ac2b52b6a37389a4aa107b059e3.zip |
cache the home folder of a User
Diffstat (limited to 'lib/private/user/user.php')
-rw-r--r-- | lib/private/user/user.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/user/user.php b/lib/private/user/user.php index e773473ec41..a9e32b5d597 100644 --- a/lib/private/user/user.php +++ b/lib/private/user/user.php @@ -38,6 +38,11 @@ class User { private $emitter; /** + * @var string $home + */ + private $home; + + /** * @param string $uid * @param \OC_User_Backend $backend * @param Emitter $emitter @@ -133,10 +138,13 @@ class User { * @return string */ public function getHome() { - if ($this->backend->implementsActions(\OC_USER_BACKEND_GET_HOME) and $home = $this->backend->getHome($this->uid)) { - return $home; + if (!$this->home) { + if ($this->backend->implementsActions(\OC_USER_BACKEND_GET_HOME) and $home = $this->backend->getHome($this->uid)) { + $this->home = $home; + } + $this->home = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data") . '/' . $this->uid; //TODO switch to Config object once implemented } - return \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data") . '/' . $this->uid; //TODO switch to Config object once implemented + return $this->home; } /** @@ -145,7 +153,7 @@ class User { * @return bool */ public function canChangeAvatar() { - if($this->backend->implementsActions(\OC_USER_BACKEND_PROVIDE_AVATAR)) { + if ($this->backend->implementsActions(\OC_USER_BACKEND_PROVIDE_AVATAR)) { return $this->backend->canChangeAvatar($this->uid); } return true; |