From b597d0b12456c8593464a06e62204797dfa4c067 Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Fri, 15 Mar 2013 16:55:57 -0700 Subject: [PATCH] CRM-12121 --- CRM/Core/BAO/ConfigSetting.php | 12 +++++++++--- CRM/Core/BAO/Setting.php | 8 ++++++-- CRM/Core/Config.php | 4 +++- CRM/Upgrade/Form.php | 6 ++++++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CRM/Core/BAO/ConfigSetting.php b/CRM/Core/BAO/ConfigSetting.php index 4a392d83ce..d912f974ea 100644 --- a/CRM/Core/BAO/ConfigSetting.php +++ b/CRM/Core/BAO/ConfigSetting.php @@ -41,7 +41,8 @@ class CRM_Core_BAO_ConfigSetting { /** - * Function to create civicrm settings. This is the same as add but it clears the cache and reloads the config object + * Function to create civicrm settings. This is the same as add but it clears the cache and + * reloads the config object * * @params array $params associated array of civicrm variables * @@ -69,11 +70,16 @@ class CRM_Core_BAO_ConfigSetting { // also set a template url so js files can use this // CRM-6194 $params['civiRelativeURL'] = CRM_Utils_System::url('CIVI_BASE_TEMPLATE'); - $params['civiRelativeURL'] = str_replace('CIVI_BASE_TEMPLATE', - '', + $params['civiRelativeURL'] = + str_replace( + 'CIVI_BASE_TEMPLATE', + '', $params['civiRelativeURL'] ); + // also add the version number for use by template / js etc + $params['civiVersion'] = CRM_Utils_System::version(); + $domain = new CRM_Core_DAO_Domain(); $domain->id = CRM_Core_Config::domainID(); $domain->find(TRUE); diff --git a/CRM/Core/BAO/Setting.php b/CRM/Core/BAO/Setting.php index 4ba094ea55..068cf3e916 100644 --- a/CRM/Core/BAO/Setting.php +++ b/CRM/Core/BAO/Setting.php @@ -524,8 +524,12 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { * - description * - help_text */ - static function getSettingSpecification($componentID = null, $filters = array(), $domainID = null, $profile = null) { - + static function getSettingSpecification( + $componentID = null, + $filters = array(), + $domainID = null, + $profile = null + ) { $cacheString = 'settingsMetadata_' . $domainID . '_' . $profile; foreach ($filters as $filterField => $filterString) { $cacheString .= "_{$filterField}_{$filterString}"; diff --git a/CRM/Core/Config.php b/CRM/Core/Config.php index b6b3faf484..247326cd69 100644 --- a/CRM/Core/Config.php +++ b/CRM/Core/Config.php @@ -323,7 +323,9 @@ class CRM_Core_Config extends CRM_Core_Config_Variables { // also make sure we create the config directory within this directory // the below statement will create both the templates directory and the config and log directory - $this->configAndLogDir = CRM_Utils_File::baseFilePath($this->templateCompileDir) . 'ConfigAndLog' . DIRECTORY_SEPARATOR; + $this->configAndLogDir = + CRM_Utils_File::baseFilePath($this->templateCompileDir) . + 'ConfigAndLog' . DIRECTORY_SEPARATOR; CRM_Utils_File::createDir($this->configAndLogDir); // we're automatically prefixing compiled templates directories with country/language code diff --git a/CRM/Upgrade/Form.php b/CRM/Upgrade/Form.php index 51ccb3f78d..ba7d885e85 100644 --- a/CRM/Upgrade/Form.php +++ b/CRM/Upgrade/Form.php @@ -614,6 +614,12 @@ SET version = '$version' // Seems extraneous in context, but we'll preserve old behavior $upgrade->setVersion($latestVer); + // lets rebuild the config array in case we've made a few changes in the + // code base + // this also helps us always store the latest version of civi in the DB + $params = array(); + CRM_Core_BAO_ConfigSetting::add($params); + // cleanup caches CRM-8739 $config = CRM_Core_Config::singleton(); $config->cleanupCaches(1, FALSE); -- 2.25.1