MDL-25161 restore - keep course->numsections unmodified
This commit is contained in:
@@ -962,12 +962,16 @@ class restore_section_structure_step extends restore_structure_step {
|
||||
// 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() {
|
||||
|
||||
Reference in New Issue
Block a user