From 8e8b9e7c98abdaadbcbaf2f76a7ee2879b86ae0a Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 14 Jun 2018 16:27:37 -0700 Subject: [PATCH] (dev/core#183) Change temp table naming for exports Testing notes - This is a pretty formulaic change. The main concern is some kind of typo or bad table name causing a hard-fail. To control that risk, we just run the code in a facile way: * Perform a contact search * Pick some contacts * Export them * Run the export We do this procedure under a few circumstances: * With the original code * With a purposefully bad edit (provoking an expected error) * With the new code --- CRM/Core/Config.php | 1 - CRM/Export/BAO/Export.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CRM/Core/Config.php b/CRM/Core/Config.php index c4517d6ca2..03bf571444 100644 --- a/CRM/Core/Config.php +++ b/CRM/Core/Config.php @@ -389,7 +389,6 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { WHERE TABLE_SCHEMA = %1 AND ( TABLE_NAME LIKE 'civicrm_import_job_%' - OR TABLE_NAME LIKE 'civicrm_export_temp%' OR TABLE_NAME LIKE 'civicrm_report_temp%' OR TABLE_NAME LIKE 'civicrm_tmp_d%' ) diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index c6fd1fabab..dd6fb35db9 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -1259,7 +1259,7 @@ VALUES $sqlValueString */ public static function createTempTable(&$sqlColumns) { //creating a temporary table for the search result that need be exported - $exportTempTable = CRM_Core_DAO::createTempTableName('civicrm_export', TRUE); + $exportTempTable = CRM_Utils_SQL_TempTable::build()->setDurable()->setCategory('export')->getName(); // also create the sql table $sql = "DROP TABLE IF EXISTS {$exportTempTable}"; -- 2.25.1