Skip to content

Commit

Permalink
MDL-25161 restore - keep course->numsections unmodified
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Nov 15, 2010
1 parent 16cad79 commit f81f513
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions backup/moodle2/restore_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -962,12 +962,16 @@ public function process_section($data) {
// Annotate the section mapping, with restorefiles option if needed
$this->set_mapping('course_section', $oldid, $newitemid, $restorefiles);

// Commented out. We never modify course->numsections as far as that is used
// by a lot of people to "hide" sections on purpose (so this remains as used to be in Moodle 1.x)
// Note: We keep the code here, to know about and because of the possibility of making this
// optional based on some setting/attribute in the future
// If needed, adjust course->numsections
if ($numsections = $DB->get_field('course', 'numsections', array('id' => $this->get_courseid()))) {
if ($numsections < $section->section) {
$DB->set_field('course', 'numsections', $section->section, array('id' => $this->get_courseid()));
}
}
//if ($numsections = $DB->get_field('course', 'numsections', array('id' => $this->get_courseid()))) {
// if ($numsections < $section->section) {
// $DB->set_field('course', 'numsections', $section->section, array('id' => $this->get_courseid()));
// }
//}
}

protected function after_execute() {
Expand Down

0 comments on commit f81f513

Please sign in to comment.