X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContact%2FBAO%2FGroupNestingCache.php;h=4d30788f311d54d85cc4d910b367e007cff99f36;hb=2717c8a52601804ca65b8a58ca439feb7b85b62e;hp=6fa5bc88b00b06627ee0b4da6ce5be54bc5e457d;hpb=e913987d303f2c51e60be23820fc8d1031e7eadd;p=civicrm-core.git diff --git a/CRM/Contact/BAO/GroupNestingCache.php b/CRM/Contact/BAO/GroupNestingCache.php index 6fa5bc88b0..4d30788f31 100644 --- a/CRM/Contact/BAO/GroupNestingCache.php +++ b/CRM/Contact/BAO/GroupNestingCache.php @@ -1,9 +1,9 @@ fetch()) { if (!array_key_exists($dao->child, $tree)) { - $tree[$dao->child] = array('children' => array(), + $tree[$dao->child] = array( + 'children' => array(), 'parents' => array(), ); } if (!array_key_exists($dao->parent, $tree)) { - $tree[$dao->parent] = array('children' => array(), + $tree[$dao->parent] = array( + 'children' => array(), 'parents' => array(), ); } @@ -80,11 +82,11 @@ SET parents = null, $values = array(); foreach (array_keys($tree) as $id) { - $parents = implode(',', $tree[$id]['parents']); + $parents = implode(',', $tree[$id]['parents']); $children = implode(',', $tree[$id]['children']); - $parents = $parents == NULL ? 'null' : "'$parents'"; + $parents = $parents == NULL ? 'null' : "'$parents'"; $children = $children == NULL ? 'null' : "'$children'"; - $sql = " + $sql = " UPDATE civicrm_group SET parents = $parents , children = $children @@ -102,7 +104,7 @@ WHERE id = $id * * @return bool */ - static function checkCyclicGraph(&$tree) { + public static function checkCyclicGraph(&$tree) { // lets keep this simple, we should probably use a graph algoritm here at some stage // foreach group that has a parent or a child, ensure that @@ -118,11 +120,11 @@ WHERE id = $id /** * @param $tree - * @param $id + * @param int $id * * @return bool */ - static function isCyclic(&$tree, $id) { + public static function isCyclic(&$tree, $id) { $parents = $children = array(); self::getAll($parent, $tree, $id, 'parents'); self::getAll($child, $tree, $id, 'children'); @@ -141,12 +143,12 @@ WHERE id = $id } /** - * @param $id + * @param int $id * @param $groups * * @return array */ - static function getPotentialCandidates($id, &$groups) { + public static function getPotentialCandidates($id, &$groups) { $tree = CRM_Core_BAO_Cache::getItem('contact groups', 'nestable tree hierarchy'); if ($tree === NULL) { @@ -168,10 +170,10 @@ WHERE id = $id /** * @param $potential * @param $tree - * @param $id + * @param int $id * @param $token */ - static function invalidate(&$potential, &$tree, $id, $token) { + public static function invalidate(&$potential, &$tree, $id, $token) { unset($potential[$id]); if (!isset($tree[$id]) || @@ -188,10 +190,10 @@ WHERE id = $id /** * @param $all * @param $tree - * @param $id + * @param int $id * @param $token */ - static function getAll(&$all, &$tree, $id, $token) { + public static function getAll(&$all, &$tree, $id, $token) { // if seen before, dont do anything if (isset($all[$id])) { return; @@ -212,7 +214,7 @@ WHERE id = $id /** * @return string */ - static function json() { + public static function json() { $tree = CRM_Core_BAO_Cache::getItem('contact groups', 'nestable tree hierarchy'); if ($tree === NULL) { @@ -258,5 +260,5 @@ WHERE id = $id }"; return $json; } -} +}