16 include_once (
"Class.Group.php");
17 include_once (
"FDL/Class.Dir.php");
24 function refreshGroups($groupIdList, $refresh =
false, &$currentPath = array() , &$groupDepth = array())
31 if (!$wg) $wg =
new group(
"", 2);
33 foreach ($groupIdList as $groupId) {
35 if (array_search($groupId, $currentPath)) {
36 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " . sprintf(
"Loop detected in group with id '%s' (path=[%s])", $groupId, join(
'-', $currentPath)));
40 $parentGroupIdList = $wg->getParentsGroupId($groupId);
42 array_push($currentPath, $groupId);
43 if (isset($groupDepth[$groupId])) $groupDepth[$groupId] = max($groupDepth[$groupId], count($currentPath));
44 else $groupDepth[$groupId] = count($currentPath);
45 refreshGroups($parentGroupIdList, $refresh, $currentPath, $groupDepth);
46 array_pop($currentPath);
49 if (count($currentPath) <= 0) {
51 uasort($groupDepth,
function (
$a, $b)
55 foreach ($groupDepth as $group => $depth) {
56 refreshOneGroup($group, $refresh);
65 foreach ($t as $k => $v) {
66 if ($v == $vp) unset($t[$k]);
70 function refreshOneGroup($gid, $refresh)
74 if ($g->fid > 0 && $g->accounttype ==
'G') {
80 if (
$doc->isAlive()) {
83 if ($refresh)
$doc->refreshMembers();
86 $doc->specPostInsert();
87 $doc->setValue(
"grp_isrefreshed",
"1");
88 $doc->modify(
true, array(
print< H1 > Check Database< i > $dbaccess</i ></H1 > $a
refreshGroups($groupIdList, $refresh=false, &$currentPath=array(), &$groupDepth=array())
new_Doc($dbaccess, $id= '', $latest=false)