MDL-23109 backup - exclude info in moodle_backup.xml about non-included task. Thanks...
authorEloy Lafuente <stronk7@moodle.org>
Thu, 22 Jul 2010 11:37:23 +0000 (11:37 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Thu, 22 Jul 2010 11:37:23 +0000 (11:37 +0000)
backup/moodle2/restore_plan_builder.class.php
backup/util/dbops/backup_controller_dbops.class.php

index fe1905c..9e3f528 100644 (file)
@@ -163,11 +163,6 @@ abstract class restore_plan_builder {
         $task = restore_factory::get_restore_course_task($info->course, $courseid);
         $plan->add_task($task);
 
-        // For the given course, add as many section tasks as necessary
-        foreach ($info->sections as $sectionid => $section) {
-            self::build_section_plan($controller, $sectionid);
-        }
-
         // For the given course path, add as many block tasks as necessary
         // TODO: Add blocks, we need to introspect xml here
         $blocks = backup_general_helper::get_blocks_from_path($task->get_taskbasepath());
@@ -178,5 +173,10 @@ abstract class restore_plan_builder {
                 // TODO: Debug information about block not supported
             }
         }
+
+        // For the given course, add as many section tasks as necessary
+        foreach ($info->sections as $sectionid => $section) {
+            self::build_section_plan($controller, $sectionid);
+        }
     }
 }
index b2c7754..cc7c631 100644 (file)
@@ -315,15 +315,19 @@ abstract class backup_controller_dbops extends backup_dbops {
 
             if ($task instanceof backup_activity_task) { // Activity task
 
-                list($contentinfo, $settings) = self::get_activity_backup_information($task);
-                $contentsinfo['activities'][] = $contentinfo;
-                $settingsinfo = array_merge($settingsinfo, $settings);
+                if ($task->get_setting_value('included')) { // Only return info about included activities
+                    list($contentinfo, $settings) = self::get_activity_backup_information($task);
+                    $contentsinfo['activities'][] = $contentinfo;
+                    $settingsinfo = array_merge($settingsinfo, $settings);
+                }
 
             } else if ($task instanceof backup_section_task) { // Section task
 
-                list($contentinfo, $settings) = self::get_section_backup_information($task);
-                $contentsinfo['sections'][] = $contentinfo;
-                $settingsinfo = array_merge($settingsinfo, $settings);
+                if ($task->get_setting_value('included')) { // Only return info about included sections
+                    list($contentinfo, $settings) = self::get_section_backup_information($task);
+                    $contentsinfo['sections'][] = $contentinfo;
+                    $settingsinfo = array_merge($settingsinfo, $settings);
+                }
 
             } else if ($task instanceof backup_course_task) { // Course task