summaryrefslogtreecommitdiffstats
path: root/lib/private/group
diff options
context:
space:
mode:
authormacjohnny <estebanmarin@gmx.ch>2014-06-19 11:37:46 +0200
committermacjohnny <estebanmarin@gmx.ch>2014-06-19 11:37:46 +0200
commit356e4b66652ef668980e995d1fde54bcaf9a8fed (patch)
treef9052f7602e75aefebd47de82b5e2ba50b9c0821 /lib/private/group
parente1fd10f22697383a4a1c2eba4e9ec4fdd9d3f841 (diff)
downloadnextcloud-server-356e4b66652ef668980e995d1fde54bcaf9a8fed.tar.gz
nextcloud-server-356e4b66652ef668980e995d1fde54bcaf9a8fed.zip
Update manager.php
add caching to getUserGroupIds
Diffstat (limited to 'lib/private/group')
-rw-r--r--lib/private/group/manager.php5
1 files changed, 4 insertions, 1 deletions
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()));