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;
if (!self::$_cache[$argString]) {
$dao = new CRM_Core_DAO_Cache();
- $dao->group_name = $group;
+ $dao->group_name = $group;
$dao->component_id = $componentID;
$dao->find();
$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
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();
}
* @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;
$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();
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;
}
}
}
- 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 = "