From fbd7413708389fbbc1dca08c15d99410878c5b88 Mon Sep 17 00:00:00 2001 From: Eloy Lafuente Date: Thu, 22 Jul 2010 11:37:23 +0000 Subject: [PATCH] MDL-23109 backup - exclude info in moodle_backup.xml about non-included task. Thanks SamH! --- backup/moodle2/restore_plan_builder.class.php | 10 +++++----- .../util/dbops/backup_controller_dbops.class.php | 16 ++++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/backup/moodle2/restore_plan_builder.class.php b/backup/moodle2/restore_plan_builder.class.php index fe1905ca760..9e3f528c80c 100644 --- a/backup/moodle2/restore_plan_builder.class.php +++ b/backup/moodle2/restore_plan_builder.class.php @@ -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); + } } } diff --git a/backup/util/dbops/backup_controller_dbops.class.php b/backup/util/dbops/backup_controller_dbops.class.php index b2c7754655c..cc7c6311563 100644 --- a/backup/util/dbops/backup_controller_dbops.class.php +++ b/backup/util/dbops/backup_controller_dbops.class.php @@ -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 -- 2.43.0