Merge branch 'MDL-75937-401' of https://github.com/stevandoMoodle/moodle into MOODLE_401_STABLE

This commit is contained in:
Jun Pataleta 2023-06-12 16:10:45 +08:00
commit fcdad9f31c
2 changed files with 55 additions and 2 deletions

View File

@ -1816,7 +1816,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 {
@ -2160,6 +2160,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;
}
}
/**
@ -4545,6 +4557,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;
}
}
@ -4755,6 +4776,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;
}
}
/**
@ -4837,6 +4867,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;
}
}
@ -4912,6 +4951,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;
}
}
@ -9162,7 +9210,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 {

View File

@ -1,6 +1,11 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 4.1.5 ===
* 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.1.4 ===
* Added a new parameter in address_in_subnet to give us the ability to check for 0.0.0.0 or not.