From 0033aaaf287f5ddb473f2effa058ae4005cf2d79 Mon Sep 17 00:00:00 2001 From: mark burdett Date: Mon, 8 Apr 2019 15:17:28 -0700 Subject: [PATCH] - Remove CIVICRM_TEMP_FORCE_UTF8 constant; - Deprecate TempTable::setUtf8() as tables should be assumed to use UTF-8 as default character set and collation (but may define columns to use some other character set and/or collation). --- CRM/Contact/Form/Search/Custom/FullText.php | 4 ++-- CRM/Contact/Form/Task.php | 2 +- CRM/Export/BAO/Export.php | 2 +- CRM/Report/Form.php | 2 +- CRM/Utils/SQL/TempTable.php | 9 +++++---- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CRM/Contact/Form/Search/Custom/FullText.php b/CRM/Contact/Form/Search/Custom/FullText.php index 43dad2e26e..daaa37e03a 100644 --- a/CRM/Contact/Form/Search/Custom/FullText.php +++ b/CRM/Contact/Form/Search/Custom/FullText.php @@ -147,7 +147,7 @@ class CRM_Contact_Form_Search_Custom_FullText extends CRM_Contact_Form_Search_Cu } public function buildTempTable() { - $table = CRM_Utils_SQL_TempTable::build()->setCategory('custom')->setMemory()->setUtf8(); + $table = CRM_Utils_SQL_TempTable::build()->setCategory('custom')->setMemory(); $this->_tableName = $table->getName(); $this->_tableFields = [ @@ -211,7 +211,7 @@ class CRM_Contact_Form_Search_Custom_FullText extends CRM_Contact_Form_Search_Cu "; $table->createWithColumns($sql); - $entityIdTable = CRM_Utils_SQL_TempTable::build()->setCategory('custom')->setMemory()->setUtf8(); + $entityIdTable = CRM_Utils_SQL_TempTable::build()->setCategory('custom')->setMemory(); $this->_entityIDTableName = $entityIdTable->getName(); $sql = " id int unsigned NOT NULL AUTO_INCREMENT, diff --git a/CRM/Contact/Form/Task.php b/CRM/Contact/Form/Task.php index 76a875ee38..bf296364a9 100644 --- a/CRM/Contact/Form/Task.php +++ b/CRM/Contact/Form/Task.php @@ -153,7 +153,7 @@ class CRM_Contact_Form_Task extends CRM_Core_Form_Task { $form->assign('taskName', CRM_Utils_Array::value($form->_task, $crmContactTaskTasks)); if ($useTable) { - $tempTable = CRM_Utils_SQL_TempTable::build()->setCategory('tskact')->setDurable()->setId($qfKey)->setUtf8(); + $tempTable = CRM_Utils_SQL_TempTable::build()->setCategory('tskact')->setDurable()->setId($qfKey); $form->_componentTable = $tempTable->getName(); $tempTable->drop(); $tempTable->createWithColumns('contact_id int primary key'); diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index ceaa4cb4ab..e1ed948387 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -652,7 +652,7 @@ VALUES $sqlValueString */ public static function createTempTable($sqlColumns) { //creating a temporary table for the search result that need be exported - $exportTempTable = CRM_Utils_SQL_TempTable::build()->setDurable()->setCategory('export')->setUtf8(); + $exportTempTable = CRM_Utils_SQL_TempTable::build()->setDurable()->setCategory('export'); // also create the sql table $exportTempTable->drop(); diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index a136d9ef6c..67c97e32d8 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -1164,7 +1164,7 @@ class CRM_Report_Form extends CRM_Core_Form { * @return string */ public function createTemporaryTable($identifier, $sql, $isColumns = FALSE, $isMemory = FALSE) { - $tempTable = CRM_Utils_SQL_TempTable::build()->setUtf8(); + $tempTable = CRM_Utils_SQL_TempTable::build(); if ($isMemory) { $tempTable->setMemory(); } diff --git a/CRM/Utils/SQL/TempTable.php b/CRM/Utils/SQL/TempTable.php index 5433b17c41..ad4cc45254 100644 --- a/CRM/Utils/SQL/TempTable.php +++ b/CRM/Utils/SQL/TempTable.php @@ -54,7 +54,7 @@ * * Example 3: Create an empty temp table with list of columns. * - * $tmpTbl = CRM_Utils_SQL_TempTable::build()->setDurable()->setUtf8()->createWithColumns('id int(10, name varchar(64)'); + * $tmpTbl = CRM_Utils_SQL_TempTable::build()->setDurable()->createWithColumns('id int(10, name varchar(64)'); * * Example 4: Drop a table that you previously created. * @@ -105,8 +105,7 @@ class CRM_Utils_SQL_TempTable { $t->id = md5(uniqid('', TRUE)); // The constant CIVICRM_TEMP_FORCE_DURABLE is for local debugging. $t->durable = CRM_Utils_Constant::value('CIVICRM_TEMP_FORCE_DURABLE', FALSE); - // @deprecated This constant is deprecated and will be removed. - $t->utf8 = CRM_Utils_Constant::value('CIVICRM_TEMP_FORCE_UTF8', TRUE); + $t->utf8 = TRUE; $t->autodrop = FALSE; $t->memory = FALSE; return $t; @@ -319,7 +318,9 @@ class CRM_Utils_SQL_TempTable { /** * Set table collation to UTF8. * - * This would make sense as a default but cautiousness during phasing in has made it opt-in. + * @deprecated This method is deprecated as tables should be assumed to have + * UTF-8 as the default character set and collation; some other character set + * or collation may be specified in the column definition. * * @param bool $value * -- 2.25.1