summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormacjohnny <estebanmarin@gmx.ch>2014-06-23 14:47:19 +0200
committermacjohnny <estebanmarin@gmx.ch>2014-06-23 14:47:19 +0200
commit24e397afd23531be46b63ce09af0d490342e343b (patch)
treecf756f56b8d9001402abb721f2f0fbcabda72237
parent405e89f45a515a825efdb673326f57e661331b19 (diff)
downloadnextcloud-server-24e397afd23531be46b63ce09af0d490342e343b.tar.gz
nextcloud-server-24e397afd23531be46b63ce09af0d490342e343b.zip
clean up function getUserGroupIds
clean up of function getUserGroupIds and improved caching mechanism of cachedUserGroupIds
-rw-r--r--lib/private/group/manager.php11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/private/group/manager.php b/lib/private/group/manager.php
index b91f6e53ebf..61226f60b3c 100644
--- a/lib/private/group/manager.php
+++ b/lib/private/group/manager.php
@@ -68,8 +68,7 @@ class Manager extends PublicEmitter {
unset($cachedGroups[$group->getGID()]);
$cachedUserGroups = array();
$Position = array_search($group->getGID(), $cachedUserGroupIds);
- if($Position !== false)
- {
+ if($Position !== false) {
unset($cachedUserGroupIds[$Position]);
}
});
@@ -194,6 +193,7 @@ class Manager extends PublicEmitter {
}
}
$this->cachedUserGroups[$uid] = array_values($groups);
+ $this->cachedUserGroupIds[$uid] = array_keys($groups);
return $this->cachedUserGroups[$uid];
}
@@ -209,13 +209,10 @@ class Manager extends PublicEmitter {
return $this->cachedUserGroupIds[$userId];
}
if (isset($this->cachedUserGroups[$userId])) {
- foreach($this->cachedUserGroups[$userId] as $group)
- {
+ foreach($this->cachedUserGroups[$userId] as $group) {
$groupIds[] = $group->getGID();
}
- }
- else
- {
+ } else {
foreach ($this->backends as $backend) {
$groupIds = array_merge($groupIds, $backend->getUserGroups($userId));
}