Permalink
Browse files

Merge branch 'MDL-39000-m23' of git://github.com/sammarshallou/moodle…

… into MOODLE_23_STABLE
  • Loading branch information...
2 parents f7f4494 + 70c3c66 commit fd33a80fa1a8e57e8161c9c2a25c9019388155c1 @danpoltawski danpoltawski committed Apr 15, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 backup/moodle2/restore_stepslib.php
@@ -1171,7 +1171,7 @@ public function after_restore() {
// Otherwise, when you restore to an existing course, it will mess up
// existing section availability entries.
if (!$this->get_mappingid('course_sections_availability', $data->id, false)) {
- return;
+ continue;
}
// Update source cmid / grade id to new value.
@@ -1184,7 +1184,12 @@ public function after_restore() {
$data->gradeitemid = null;
}
- $DB->update_record('course_sections_availability', $data);
+ // Delete the record if the condition wasn't found, otherwise update it.
+ if ($data->sourcecmid === null && $data->gradeitemid === null) {
+ $DB->delete_records('course_sections_availability', array('id' => $data->id));
+ } else {
+ $DB->update_record('course_sections_availability', $data);
+ }
}
}
}

0 comments on commit fd33a80

Please sign in to comment.