MDL-67870 backup: Skip value change if setting is locked by hierarchy

The given condition in the if statement did not take into account cases
when the setting is locked by hierarchy. Settings which are locked by
hierarchy should should keep their current values which were inherited
from the parent.
This commit is contained in:
Mihail Geshoski
2021-03-22 15:33:39 +08:00
parent c1db56b501
commit 66f592e71b
+3 -1
View File
@@ -116,7 +116,9 @@ class backup_ui_stage_initial extends backup_ui_stage {
if (isset($data->$name) && $data->$name != $setting->get_value()) {
$setting->set_value($data->$name);
$changes++;
} else if (!isset($data->$name) && $setting->get_ui_type() == backup_setting::UI_HTML_CHECKBOX && $setting->get_value()) {
} else if (!isset($data->$name) && $setting->get_value() &&
$setting->get_ui_type() == backup_setting::UI_HTML_CHECKBOX &&
$setting->get_status() !== backup_setting::LOCKED_BY_HIERARCHY) {
$setting->set_value(0);
$changes++;
}