diff options
author | Bart Visscher <bartv@thisnet.nl> | 2014-02-21 22:53:31 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2014-02-21 23:07:35 +0100 |
commit | f4f72e77d8bf312b6fc693d43ef5fc831130db3b (patch) | |
tree | c9676ebd83337c761beb2c2f82acc76530203783 /lib/private/user/user.php | |
parent | 6f4ecd32b37cc668ee0d59721c2451f349bb9290 (diff) | |
download | nextcloud-server-f4f72e77d8bf312b6fc693d43ef5fc831130db3b.tar.gz nextcloud-server-f4f72e77d8bf312b6fc693d43ef5fc831130db3b.zip |
Delay fetching the display name until it is requested
Diffstat (limited to 'lib/private/user/user.php')
-rw-r--r-- | lib/private/user/user.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/private/user/user.php b/lib/private/user/user.php index ef5364cbf7b..710f9061b53 100644 --- a/lib/private/user/user.php +++ b/lib/private/user/user.php @@ -55,11 +55,6 @@ class User { */ public function __construct($uid, $backend, $emitter = null, $config = null) { $this->uid = $uid; - if ($backend and $backend->implementsActions(OC_USER_BACKEND_GET_DISPLAYNAME)) { - $this->displayName = $backend->getDisplayName($uid); - } else { - $this->displayName = $uid; - } $this->backend = $backend; $this->emitter = $emitter; $this->config = $config; @@ -86,6 +81,13 @@ class User { * @return string */ public function getDisplayName() { + if (!isset($this->displayName)) { + if ($this->backend and $this->backend->implementsActions(OC_USER_BACKEND_GET_DISPLAYNAME)) { + $this->displayName = $this->backend->getDisplayName($this->uid); + } else { + $this->displayName = $this->uid; + } + } return $this->displayName; } |