From 7ee2786ab5acb96735eb4bdaecd35afb41938d34 Mon Sep 17 00:00:00 2001 From: kurund Date: Fri, 30 Aug 2013 11:50:01 +0530 Subject: [PATCH] CRM-13066, move data from civicrm_cache to civicrm_batch table ---------------------------------------- * CRM-13066: 'Clean up Caches' deletes in progress batches http://issues.civicrm.org/jira/browse/CRM-13066 --- CRM/Batch/BAO/Batch.php | 13 ------------- CRM/Upgrade/Incremental/php/FourFour.php | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/CRM/Batch/BAO/Batch.php b/CRM/Batch/BAO/Batch.php index 4f87523ded..9de9d3d4d0 100644 --- a/CRM/Batch/BAO/Batch.php +++ b/CRM/Batch/BAO/Batch.php @@ -176,19 +176,6 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch { return true; } - /** - * function to get cachekey for batch - * - * @param int $batchId batch id - * - * @retun string $cacheString - * @static - * @access public - */ - static function getCacheKeyForBatch($batchId) { - return "batch-entry-{$batchId}"; - } - /** * This function is a wrapper for ajax batch selector * diff --git a/CRM/Upgrade/Incremental/php/FourFour.php b/CRM/Upgrade/Incremental/php/FourFour.php index bab3a82596..cbf45f67d8 100644 --- a/CRM/Upgrade/Incremental/php/FourFour.php +++ b/CRM/Upgrade/Incremental/php/FourFour.php @@ -77,6 +77,26 @@ class CRM_Upgrade_Incremental_php_FourFour { return TRUE; } + function upgrade_4_4_beta1($rev) { + $this->addTask(ts('Upgrade DB to 4.4.beta1: SQL'), 'task_4_4_x_runSql', $rev); + + // check if batch entry data exists in civicrm_cache table + $query = 'select path, data from civicrm_cache where group_name = "batch entry"'; + $dao = CRM_Core_DAO::executeQuery($query); + while ($dao->fetch()) { + // get batch id $batchId[2] + $batchId = explode('-', $dao->path); + $data = unserialize($dao->data); + + // move the data to civicrm_batch table + CRM_Core_DAO::setFieldValue('CRM_Batch_DAO_Batch', $batchId[2], 'data', json_encode(array('values' => $data))); + } + + // delete entries from civicrm_cache table + $query = 'DELETE from civicrm_cache where group_name = "batch entry"'; + CRM_Core_DAO::executeQuery($query); + } + /** * Update activity contacts CRM-12274 * -- 2.25.1