MDL-75937 admin: Fixed config data display inconsistency
This commit is contained in:
+50
-2
@@ -1820,7 +1820,7 @@ abstract class admin_setting {
|
||||
global $CFG;
|
||||
|
||||
if (empty($this->plugin)) {
|
||||
if (array_key_exists($this->name, $CFG->config_php_settings)) {
|
||||
if ($this->is_forceable() && array_key_exists($this->name, $CFG->config_php_settings)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
@@ -2164,6 +2164,18 @@ abstract class admin_setting {
|
||||
public function has_custom_form_control(): bool {
|
||||
return $this->customcontrol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the setting can be overridden in config.php.
|
||||
*
|
||||
* Returning true will allow the setting to be defined and overridden in config.php.
|
||||
* Returning false will prevent the config setting from being overridden even when it gets defined in config.php.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_forceable(): bool {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4600,6 +4612,15 @@ class admin_setting_sitesetselect extends admin_setting_configselect {
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* admin_setting_sitesetselect is not meant to be overridden in config.php.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_forceable(): bool {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4810,6 +4831,15 @@ class admin_setting_sitesetcheckbox extends admin_setting_configcheckbox {
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* admin_setting_sitesetcheckbox is not meant to be overridden in config.php.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_forceable(): bool {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4892,6 +4922,15 @@ class admin_setting_sitesettext extends admin_setting_configtext {
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* admin_setting_sitesettext is not meant to be overridden in config.php.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_forceable(): bool {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4967,6 +5006,15 @@ class admin_setting_special_frontpagedesc extends admin_setting_confightmleditor
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* admin_setting_special_frontpagedesc is not meant to be overridden in config.php.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_forceable(): bool {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9044,7 +9092,7 @@ function format_admin_setting($setting, $title='', $form='', $description='', $l
|
||||
$context->warning = $warning;
|
||||
$context->override = '';
|
||||
if (empty($setting->plugin)) {
|
||||
if (array_key_exists($setting->name, $CFG->config_php_settings)) {
|
||||
if ($setting->is_forceable() && array_key_exists($setting->name, $CFG->config_php_settings)) {
|
||||
$context->override = get_string('configoverride', 'admin');
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
This files describes API changes in core libraries and APIs,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 4.2.2 ===
|
||||
* Added new \admin_setting::is_forceable() method to determine whether the setting can be overridden or not. Therefore,
|
||||
whether the settings can be overriden or not will depend on the value of implemented \admin_setting::is_forceable() method,
|
||||
even if we define the settings in config.php.
|
||||
|
||||
=== 4.2.1 ===
|
||||
* Added a new parameter in address_in_subnet to give us the ability to check for 0.0.0.0 or not.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user