From: Tim Otten Date: Mon, 7 Sep 2015 23:39:23 +0000 (-0700) Subject: CRM_Core_BAO_ConfigSetting::formatParams - Remove silly function X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6e5b5e594a28d5dd020bf7ae455b4c4937a9c98f;p=civicrm-core.git CRM_Core_BAO_ConfigSetting::formatParams - Remove silly function This function is basically just array_merge(). In theory, there's a side-effect where NULL values in `$values` are unset, but neither use-case seems to make any use of `$values` afterward, and that smells like an accidental side-effect anyway. --- diff --git a/CRM/Admin/Form/Setting/Smtp.php b/CRM/Admin/Form/Setting/Smtp.php index f0a4174d63..e7569919ed 100644 --- a/CRM/Admin/Form/Setting/Smtp.php +++ b/CRM/Admin/Form/Setting/Smtp.php @@ -181,7 +181,7 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting { ); if (!empty($mailingBackend)) { - CRM_Core_BAO_ConfigSetting::formatParams($formValues, $mailingBackend); + $formValues = array_merge($mailingBackend, $formValues); } // if password is present, encrypt it diff --git a/CRM/Core/BAO/ConfigSetting.php b/CRM/Core/BAO/ConfigSetting.php index 9d6813bcf6..b632a72a23 100644 --- a/CRM/Core/BAO/ConfigSetting.php +++ b/CRM/Core/BAO/ConfigSetting.php @@ -65,8 +65,7 @@ class CRM_Core_BAO_ConfigSetting { $domain->id = CRM_Core_Config::domainID(); $domain->find(TRUE); if ($domain->config_backend) { - $values = unserialize($domain->config_backend); - self::formatParams($params, $values); + $params = array_merge(unserialize($domain->config_backend), $params); } // unset any of the variables we read from file that should not be stored in the database @@ -139,30 +138,6 @@ class CRM_Core_BAO_ConfigSetting { } } - /** - * Format the array containing before inserting in db. - * - * @param array $params - * Associated array of civicrm variables(submitted). - * @param array $values - * Associated array of civicrm variables stored in db. - */ - public static function formatParams(&$params, &$values) { - if (empty($params) || - !is_array($params) - ) { - $params = $values; - } - else { - foreach ($params as $key => $val) { - if (array_key_exists($key, $values)) { - unset($values[$key]); - } - } - $params = array_merge($params, $values); - } - } - /** * Retrieve the settings values from db. *