From 356e4b66652ef668980e995d1fde54bcaf9a8fed Mon Sep 17 00:00:00 2001 From: macjohnny Date: Thu, 19 Jun 2014 11:37:46 +0200 Subject: Update manager.php add caching to getUserGroupIds --- lib/private/group/manager.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/private/group/manager.php') diff --git a/lib/private/group/manager.php b/lib/private/group/manager.php index 3613c7547bd..fc90d4cb643 100644 --- a/lib/private/group/manager.php +++ b/lib/private/group/manager.php @@ -179,7 +179,7 @@ class Manager extends PublicEmitter { $groups[$groupId] = $this->get($groupId); } } - $this->cachedUserGroups[$uid] = array_values($groups); + $this->cachedUserGroups[$uid] = $groups; return $this->cachedUserGroups[$uid]; } /** @@ -187,6 +187,9 @@ class Manager extends PublicEmitter { * @return array with group names */ public function getUserGroupIds($user) { + if (isset($this->cachedUserGroups[$uid])) { + return array_keys($this->cachedUserGroups[$uid]); + } $groupIds = array(); foreach ($this->backends as $backend) { $groupIds = array_merge($groupIds, $backend->getUserGroups($user->getUID())); -- cgit v1.2.3