X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContact%2FBAO%2FGroupNestingCache.php;h=4d30788f311d54d85cc4d910b367e007cff99f36;hb=2717c8a52601804ca65b8a58ca439feb7b85b62e;hp=4e02a079a3e85b4927ece0f32518d0c62e714428;hpb=39de6fd54b9843705d13cb9f70fbcc6296103670;p=civicrm-core.git diff --git a/CRM/Contact/BAO/GroupNestingCache.php b/CRM/Contact/BAO/GroupNestingCache.php index 4e02a079a3..4d30788f31 100644 --- a/CRM/Contact/BAO/GroupNestingCache.php +++ b/CRM/Contact/BAO/GroupNestingCache.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.6 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -23,12 +23,12 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2014 + * @copyright CiviCRM LLC (c) 2004-2015 * $Id$ * */ @@ -51,13 +51,15 @@ WHERE n.child_group_id = gc.id $tree = array(); while ($dao->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 @@ -122,7 +124,7 @@ WHERE id = $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'); @@ -146,7 +148,7 @@ WHERE id = $id * * @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) { @@ -171,7 +173,7 @@ WHERE id = $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]) || @@ -191,7 +193,7 @@ WHERE id = $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; } -} +}