Skip to content
Snippets Groups Projects
Commit 889bb141 authored by totten's avatar totten
Browse files

(#1387) ConfigSetting - Deprecation+guard for retrieve()/add()

These functions were traditionally used for accessing `config_backend`,
which was (mostly) dropped in v4.7 and became inert. However, the
functions are still referenced in a couple oddball cases.

Note that the references to `$domain->config_backend` are liable to raise
warnings if evaluated - since the field no longer exists on the DAO class.
Consequently, the extra `$hasBackend` guard should reduce warnings.
parent 502b6747
Branches
Tags
No related merge requests found
......@@ -41,6 +41,9 @@ class CRM_Core_BAO_ConfigSetting {
*
* @param array $params
* Associated array of civicrm variables.
* @deprecated
* This method was historically used to access civicrm_domain.config_backend.
* However, that has been fully replaced by the settings system since v4.7.
*/
public static function add(&$params) {
$domain = new CRM_Core_DAO_Domain();
......@@ -69,6 +72,9 @@ class CRM_Core_BAO_ConfigSetting {
* @param $defaults
*
* @return array
* @deprecated
* This method was historically used to access civicrm_domain.config_backend.
* However, that has been fully replaced by the settings system since v4.7.
*/
public static function retrieve(&$defaults) {
$domain = new CRM_Core_DAO_Domain();
......@@ -80,7 +86,8 @@ class CRM_Core_BAO_ConfigSetting {
$urlVar = 'task';
}
if ($isUpgrade && CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_domain', 'config_backend')) {
$hasBackend = CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_domain', 'config_backend');
if ($isUpgrade && $hasBackend) {
$domain->selectAdd('config_backend');
}
else {
......@@ -89,7 +96,10 @@ class CRM_Core_BAO_ConfigSetting {
$domain->id = CRM_Core_Config::domainID();
$domain->find(TRUE);
if ($domain->config_backend) {
if ($hasBackend && $domain->config_backend) {
// This whole branch can probably be removed; the transitional loading
// is in SettingBag::loadValues(). Moreover, since 4.7.alpha1 dropped
// the column, anyone calling ::retrieve() has likely not gotten any data.
$defaults = unserialize($domain->config_backend);
if ($defaults === FALSE || !is_array($defaults)) {
$defaults = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment