From 1c71d5c444a0f4b2263ffb1d2a40969880151015 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 16 Apr 2014 12:56:08 +0200 Subject: [PATCH] LDAP: cache display names immediately on retrieval, saves tens of unecessary queries to LDAP server in the share dialog for example --- apps/user_ldap/lib/access.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index 8d622dcb79..d047149fc7 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -434,12 +434,18 @@ class Access extends LDAPUtility { $ocname = $this->dn2ocname($ldapObject['dn'], $nameByLDAP, $isUsers); if($ocname) { $ownCloudNames[] = $ocname; + $this->cacheDisplayName($ocname, $nameByLDAP); } continue; } return $ownCloudNames; } + public function cacheDisplayName($uid, $displayName) { + $cacheKeyTrunk = 'getDisplayName'; + $this->connection->writeToCache($cacheKeyTrunk.$uid,$displayName); + } + /** * @brief creates a unique name for internal ownCloud use for users. Don't call it directly. * @param $name the display name of the object