From eb917190c01e3f8efb93a8627bd477849ab558f1 Mon Sep 17 00:00:00 2001 From: kurund Date: Fri, 30 Aug 2013 14:09:49 +0530 Subject: [PATCH] Revert "Merge pull request #1544 from eileenmcnaughton/master" This reverts commit 008240e2a4a0a3957d58c891604656a679fbf0c6, reversing changes made to f1951871b75764859fd45e23aff8933bf955de36. --- CRM/Contact/BAO/GroupContactCache.php | 21 +++++---------------- api/api.php | 2 +- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/CRM/Contact/BAO/GroupContactCache.php b/CRM/Contact/BAO/GroupContactCache.php index 14a4c7c70d..90b2cdd62f 100644 --- a/CRM/Contact/BAO/GroupContactCache.php +++ b/CRM/Contact/BAO/GroupContactCache.php @@ -209,19 +209,14 @@ AND g.refresh_date IS NULL // sort the values so we put group IDs in front and hence optimize // mysql storage (or so we think) CRM-9493 sort($values); - $tempTable = 'civicrm_temp_group_contact_cache' . rand(0,2000); + // to avoid long strings, lets do BULK_INSERT_COUNT values at a time while (!empty($values)) { $processed = TRUE; $input = array_splice($values, 0, CRM_Core_DAO::BULK_INSERT_COUNT); $str = implode(',', $input); - $sql = "CREATE TEMPORARY TABLE $tempTable $str;"; + $sql = "INSERT IGNORE INTO civicrm_group_contact_cache (group_id,contact_id) VALUES $str;"; CRM_Core_DAO::executeQuery($sql); - CRM_Core_DAO::executeQuery( - "INSERT IGNORE INTO civicrm_group_contact_cache (contact_id, group_id) - SELECT DISTINCT id, group_id FROM $tempTable - "); - CRM_Core_DAO::executeQuery(" DROP TABLE $tempTable"); } self::updateCacheTime($groupID, $processed); } @@ -485,22 +480,16 @@ WHERE civicrm_group_contact.status = 'Added' $groupIDs = array($groupID); self::remove($groupIDs); + $processed = FALSE; - $tempTable = 'civicrm_temp_group_contact_cache' . rand(0,2000); foreach (array($sql, $sqlB) as $selectSql) { if (!$selectSql) { continue; } - $insertSql = "CREATE TEMPORARY TABLE $tempTable ($selectSql);"; - $processed = TRUE; // FIXME + $insertSql = "INSERT IGNORE INTO civicrm_group_contact_cache (group_id,contact_id) ($selectSql);"; + $processed = TRUE; $result = CRM_Core_DAO::executeQuery($insertSql); - CRM_Core_DAO::executeQuery( - "INSERT IGNORE INTO civicrm_group_contact_cache (contact_id, group_id) - SELECT DISTINCT id, group_id FROM $tempTable - "); - CRM_Core_DAO::executeQuery(" DROP TABLE $tempTable"); } - self::updateCacheTime($groupIDs, $processed); if ($group->children) { diff --git a/api/api.php b/api/api.php index 918e13a10f..f42d5ac8da 100644 --- a/api/api.php +++ b/api/api.php @@ -43,7 +43,7 @@ function civicrm_api($entity, $action, $params, $extra = NULL) { $errorScope = CRM_Core_TemporaryErrorScope::useException(); // look up function, file, is_generic $apiRequest += _civicrm_api_resolve($apiRequest); - if (strtolower($action) == 'create' || strtolower($action) == 'delete' || strtolower($action) == 'submit') { + if (strtolower($action) == 'create' || strtolower($action) == 'delete') { $apiRequest['is_transactional'] = 1; $transaction = new CRM_Core_Transaction(); } -- 2.25.1