Skip to content

Commit 6202720

Browse files
committed
use getGroupMemberUIDs inside getGroupMembers
1 parent e482fbc commit 6202720

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

resources/lib/UnityGroup.php

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -460,20 +460,7 @@ public function getRequests()
460460

461461
public function getGroupMembers($ignorecache = false)
462462
{
463-
if (!$ignorecache) {
464-
$cached_val = $this->REDIS->getCache($this->getPIUID(), "members");
465-
if (!is_null($cached_val)) {
466-
$members = $cached_val;
467-
}
468-
}
469-
470-
$updatecache = false;
471-
if (!isset($members)) {
472-
$pi_group = $this->getLDAPPiGroup();
473-
$members = $pi_group->getAttribute("memberuid");
474-
$updatecache = true;
475-
}
476-
463+
$members = $this->getGroupMemberUIDs($ignorecache);
477464
$out = array();
478465
$cache_arr = array();
479466
$owner_uid = $this->getOwner()->getUID();
@@ -490,19 +477,27 @@ public function getGroupMembers($ignorecache = false)
490477
array_push($cache_arr, $user_obj->getUID());
491478
}
492479

493-
if (!$ignorecache && $updatecache) {
494-
sort($cache_arr);
495-
$this->REDIS->setCache($this->getPIUID(), "members", $cache_arr);
496-
}
497-
498480
return $out;
499481
}
500482

501-
public function getGroupMemberUIDs()
483+
public function getGroupMemberUIDs($ignorecache = false)
502484
{
503-
$pi_group = $this->getLDAPPiGroup();
504-
$members = $pi_group->getAttribute("memberuid");
505-
485+
if (!$ignorecache) {
486+
$cached_val = $this->REDIS->getCache($this->getPIUID(), "members");
487+
if (!is_null($cached_val)) {
488+
return $cached_val;
489+
}
490+
}
491+
$updatecache = false;
492+
if (!isset($members)) {
493+
$pi_group = $this->getLDAPPiGroup();
494+
$members = $pi_group->getAttribute("memberuid");
495+
$updatecache = true;
496+
}
497+
if (!$ignorecache && $updatecache) {
498+
sort($cache_arr);
499+
$this->REDIS->setCache($this->getPIUID(), "members", $cache_arr);
500+
}
506501
return $members;
507502
}
508503

0 commit comments

Comments
 (0)