MDL-25161 restore - keep course->numsections unmodified
authorEloy Lafuente <stronk7@moodle.org>
Mon, 15 Nov 2010 17:10:11 +0000 (17:10 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Mon, 15 Nov 2010 17:10:11 +0000 (17:10 +0000)
backup/moodle2/restore_stepslib.php

index 1664f2a..2a3fe48 100644 (file)
@@ -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() {