From f4f72e77d8bf312b6fc693d43ef5fc831130db3b Mon Sep 17 00:00:00 2001 From: Bart Visscher <bartv@thisnet.nl> Date: Fri, 21 Feb 2014 22:53:31 +0100 Subject: [PATCH] Delay fetching the display name until it is requested --- lib/private/user/user.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/private/user/user.php b/lib/private/user/user.php index ef5364cbf7..710f9061b5 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; } -- GitLab