Skip to content

Commit 7b3bba9

Browse files
committed
Issue 1401: Fix backup restore when settings are not present
1 parent 7160813 commit 7b3bba9

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎backup/moodle2/restore_theme_boost_union_plugin.class.php‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ public function process_courseoverride($data) {
6868
) {
6969
// If the user does not want to restore this setting, return.
7070
$restorecontrolledby = $coursesettings[$data->name]['restorecontrolledby'] ?? null;
71-
$restoreconfig = $this->task->get_setting_value($restorecontrolledby);
72-
if ($restoreconfig != true) {
73-
return;
71+
if ($restorecontrolledby && $this->task->setting_exists($restorecontrolledby)) {
72+
$restoreconfig = $this->task->get_setting_value($restorecontrolledby);
73+
if ($restoreconfig != true) {
74+
return;
75+
}
7476
}
7577
}
7678

@@ -99,9 +101,11 @@ public function after_restore_course() {
99101
if (array_key_exists('restorecontrolledby', $config)) {
100102
// If the user does not want to restore this filearea, return.
101103
$restorecontrolledby = $config['restorecontrolledby'] ?? null;
102-
$restoreconfig = $this->task->get_setting_value($restorecontrolledby);
103-
if ($restoreconfig != true) {
104-
return;
104+
if ($restorecontrolledby && $this->task->setting_exists($restorecontrolledby)) {
105+
$restoreconfig = $this->task->get_setting_value($restorecontrolledby);
106+
if ($restoreconfig != true) {
107+
return;
108+
}
105109
}
106110
}
107111

0 commit comments

Comments
 (0)