INFRA-132 - Comment grammar cleanup
[civicrm-core.git] / CRM / Core / BAO / Cache.php
index 31776e24ebbcb6240a65b22c14e39ac3185dde20..195d09e20695dd4fda0016fd22be01fc7c422510 100644 (file)
@@ -76,8 +76,8 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
       if (!self::$_cache[$argString]) {
         $dao = new CRM_Core_DAO_Cache();
 
-        $dao->group_name   = $group;
-        $dao->path         = $path;
+        $dao->group_name = $group;
+        $dao->path = $path;
         $dao->component_id = $componentID;
 
         $data = NULL;
@@ -115,7 +115,7 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
       if (!self::$_cache[$argString]) {
         $dao = new CRM_Core_DAO_Cache();
 
-        $dao->group_name   = $group;
+        $dao->group_name = $group;
         $dao->component_id = $componentID;
         $dao->find();
 
@@ -155,8 +155,8 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
 
     $dao = new CRM_Core_DAO_Cache();
 
-    $dao->group_name   = $group;
-    $dao->path         = $path;
+    $dao->group_name = $group;
+    $dao->path = $path;
     $dao->component_id = $componentID;
 
     // get a lock so that multiple ajax requests on the same page
@@ -249,28 +249,28 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
   public static function storeSessionToCache($names, $resetSession = TRUE) {
     foreach ($names as $key => $sessionName) {
       if (is_array($sessionName)) {
-        $value = null;
+        $value = NULL;
         if (!empty($_SESSION[$sessionName[0]][$sessionName[1]])) {
           $value = $_SESSION[$sessionName[0]][$sessionName[1]];
         }
         self::setItem($value, 'CiviCRM Session', "{$sessionName[0]}_{$sessionName[1]}");
-          if ($resetSession) {
-            $_SESSION[$sessionName[0]][$sessionName[1]] = NULL;
-            unset($_SESSION[$sessionName[0]][$sessionName[1]]);
-          }
+        if ($resetSession) {
+          $_SESSION[$sessionName[0]][$sessionName[1]] = NULL;
+          unset($_SESSION[$sessionName[0]][$sessionName[1]]);
         }
+      }
       else {
-        $value = null;
+        $value = NULL;
         if (!empty($_SESSION[$sessionName])) {
           $value = $_SESSION[$sessionName];
         }
         self::setItem($value, 'CiviCRM Session', $sessionName);
-          if ($resetSession) {
-            $_SESSION[$sessionName] = NULL;
-            unset($_SESSION[$sessionName]);
-          }
+        if ($resetSession) {
+          $_SESSION[$sessionName] = NULL;
+          unset($_SESSION[$sessionName]);
         }
       }
+    }
 
     self::cleanup();
   }
@@ -321,7 +321,7 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
    * @return void
    * @static
    */
-  public static function cleanup($session = false, $table = false, $prevNext = false) {
+  public static function cleanup($session = FALSE, $table = FALSE, $prevNext = FALSE) {
     // clean up the session cache every $cacheCleanUpNumber probabilistically
     $cleanUpNumber = 757;
 
@@ -330,19 +330,19 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
     $timeIntervalMins = 30;
 
     if (mt_rand(1, 100000) % $cleanUpNumber == 0) {
-      $session = $table = $prevNext = true;
+      $session = $table = $prevNext = TRUE;
     }
 
-    if ( ! $session && ! $table && ! $prevNext ) {
+    if (!$session && !$table && !$prevNext) {
       return;
     }
 
-    if ( $prevNext ) {
+    if ($prevNext) {
       // delete all PrevNext caches
       CRM_Core_BAO_PrevNextCache::cleanupCache();
     }
 
-    if ( $table ) {
+    if ($table) {
       // also delete all the action temp tables
       // that were created the same interval ago
       $dao = new CRM_Core_DAO();
@@ -356,9 +356,9 @@ AND    ( TABLE_NAME LIKE 'civicrm_task_action_temp_%'
 AND    CREATE_TIME < date_sub( NOW( ), INTERVAL $timeIntervalDays day )
 ";
 
-      $params   = array(1 => array($dao->database(), 'String'));
+      $params = array(1 => array($dao->database(), 'String'));
       $tableDAO = CRM_Core_DAO::executeQuery($query, $params);
-      $tables   = array();
+      $tables = array();
       while ($tableDAO->fetch()) {
         $tables[] = $tableDAO->tableName;
       }
@@ -369,27 +369,27 @@ AND    CREATE_TIME < date_sub( NOW( ), INTERVAL $timeIntervalDays day )
       }
     }
 
-    if ( $session ) {
+    if ($session) {
       // first delete all sessions which are related to any potential transaction
       // page
       $transactionPages = array(
-          'CRM_Contribute_Controller_Contribution',
-          'CRM_Event_Controller_Registration',
-        );
+        'CRM_Contribute_Controller_Contribution',
+        'CRM_Event_Controller_Registration',
+      );
 
       $params = array(
         1 => array(date('Y-m-d H:i:s', time() - $timeIntervalMins * 60), 'String'),
       );
       foreach ($transactionPages as $trPage) {
         $params[] = array("%${trPage}%", 'String');
-        $where[]  = 'path LIKE %' . sizeof($params);
+        $where[] = 'path LIKE %' . sizeof($params);
       }
 
       $sql = "
 DELETE FROM civicrm_cache
 WHERE       group_name = 'CiviCRM Session'
 AND         created_date <= %1
-AND         ("  . implode(' OR ', $where) . ")";
+AND         (" . implode(' OR ', $where) . ")";
       CRM_Core_DAO::executeQuery($sql, $params);
 
       $sql = "