Commit 7e0c769c authored by totten's avatar totten

CRM-16373 - CRM_Admin_Form_Setting - Generate error instead of saving config fields

parent dc378d98
......@@ -267,7 +267,11 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form {
CRM_Core_Session::setStatus($result['error_message'], ts('Save Failed'), 'error');
}
CRM_Core_BAO_ConfigSetting::create($params);
//CRM_Core_BAO_ConfigSetting::create($params);
$params = CRM_Core_BAO_ConfigSetting::filterSkipVars($params);
if (!empty($params)) {
CRM_Core_Error::fatal('Unrecognized setting. This may be a config field which has not been properly migrated to a setting. (' . implode(', ', array_keys($params)) . ')');
}
CRM_Core_Config::clearDBCache();
CRM_Utils_System::flushCache();
......
......@@ -66,13 +66,7 @@ class CRM_Core_BAO_ConfigSetting {
$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
// the username and certpath are stored flat with _test and _live
// check CRM-1470
$skipVars = self::skipVars();
foreach ($skipVars as $var) {
unset($params[$var]);
}
$params = CRM_Core_BAO_ConfigSetting::filterSkipVars($params);
// also skip all Dir Params, we dont need to store those in the DB!
foreach ($params as $name => $val) {
......@@ -626,6 +620,7 @@ WHERE option_group_id = (
'qfKey',
'gettextResourceDir',
'cleanURL',
'entryURL',
'locale_custom_strings',
'localeCustomStrings',
'autocompleteContactSearch',
......@@ -635,4 +630,21 @@ WHERE option_group_id = (
);
}
/**
* @param array $params
* @return array
*/
public static function filterSkipVars($params) {
$skipVars = self::skipVars();
foreach ($skipVars as $var) {
unset($params[$var]);
}
foreach (array_keys($params) as $key) {
if (preg_match('/^_qf_/', $key)) {
unset($params[$key]);
}
}
return $params;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment