From e95f2ce434f572593cfb90aedb0dbef3614a34a4 Mon Sep 17 00:00:00 2001 From: Mathieu Lutfy Date: Sun, 7 Jan 2018 17:30:36 -0500 Subject: [PATCH 1/2] CRM-21627: makeMultilingual: update dbLocale to avoid fatal if lcMessages was not set. --- CRM/Core/I18n/Schema.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CRM/Core/I18n/Schema.php b/CRM/Core/I18n/Schema.php index 7efdc5103cd2..b795deacabd0 100644 --- a/CRM/Core/I18n/Schema.php +++ b/CRM/Core/I18n/Schema.php @@ -107,6 +107,9 @@ public static function makeMultilingual($locale) { // update civicrm_domain.locales $domain->locales = $locale; $domain->save(); + + // CRM-21627 Updates the $dbLocale + CRM_Core_BAO_ConfigSetting::applyLocale(Civi::settings($domain->id), $domain->locales); } /** From acc4713871d28ee51adbd75ad434fb4526a171d6 Mon Sep 17 00:00:00 2001 From: Mathieu Lutfy Date: Tue, 9 Jan 2018 15:53:58 -0500 Subject: [PATCH 2/2] CRM-21627: makeMultilingual: update dbLocale to avoid fatal if lcMessages was not set (adds unit-test fix by Monish Deb) --- tests/phpunit/CRM/Logging/LoggingTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/CRM/Logging/LoggingTest.php b/tests/phpunit/CRM/Logging/LoggingTest.php index f0422ca86987..717985439758 100644 --- a/tests/phpunit/CRM/Logging/LoggingTest.php +++ b/tests/phpunit/CRM/Logging/LoggingTest.php @@ -41,13 +41,13 @@ public function testMultilingualAlterSchemaLogging() { $value = CRM_Core_DAO::singleValueQuery("SELECT id FROM log_civicrm_contact LIMIT 1", array(), FALSE, FALSE); $this->assertNotNull($value, 'Logging not enabled successfully'); $logging->disableLogging(); - CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_option_value` ADD COLUMN `logging_test` INT DEFAULT NULL", array(), FALSE, NULL, FALSE, TRUE); + CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_option_value` ADD COLUMN `logging_test` INT DEFAULT NULL", array(), FALSE, NULL, FALSE, FALSE); CRM_Core_I18n_Schema::rebuildMultilingualSchema(array('en_US')); $logging->enableLogging(); $query = CRM_Core_DAO::executeQuery("SHOW CREATE TABLE `log_civicrm_option_value`", array(), TRUE, NULL, FALSE, FALSE); $query->fetch(); $create = explode("\n", $query->Create_Table); - CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_option_value` DROP COLUMN `logging_test`", array(), FALSE, NULL, FALSE, TRUE); + CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_option_value` DROP COLUMN `logging_test`", array(), FALSE, NULL, FALSE, FALSE); $this->assertTrue(in_array(" `logging_test` int(11) DEFAULT NULL", $create)); $logging->disableLogging(); }