Merge pull request #6548 from eileenmcnaughton/CRM-16512
[civicrm-core.git] / CRM / Contact / BAO / GroupNestingCache.php
index dad6896268f1f9909f1dca19814d00e5ea4f1620..4d30788f311d54d85cc4d910b367e007cff99f36 100644 (file)
@@ -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.                                    |
  |                                                                    |
  | 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
@@ -258,4 +260,5 @@ WHERE  id = $id
 }";
     return $json;
   }
+
 }