MDL-28156 restore - fix some notices restoring empty courses
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 10 Jul 2011 11:12:05 +0000 (13:12 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 10 Jul 2011 11:13:23 +0000 (13:13 +0200)
backup/util/helper/backup_general_helper.class.php

index ee86c1a..20238fe 100644 (file)
@@ -153,7 +153,9 @@ abstract class backup_general_helper extends backup_helper {
         $rolemappings->modified = false;
         $rolemappings->mappings = array();
         $info->role_mappings = $rolemappings;
         $rolemappings->modified = false;
         $rolemappings->mappings = array();
         $info->role_mappings = $rolemappings;
-
+        // Some initially empty containers
+        $info->sections = array();
+        $info->activities = array();
 
         // Now the contents
         $contentsarr = $infoarr['contents'];
 
         // Now the contents
         $contentsarr = $infoarr['contents'];
@@ -164,7 +166,6 @@ abstract class backup_general_helper extends backup_helper {
         }
         if (isset($contentsarr['sections']) && isset($contentsarr['sections']['section'])) {
             $sectionarr = $contentsarr['sections']['section'];
         }
         if (isset($contentsarr['sections']) && isset($contentsarr['sections']['section'])) {
             $sectionarr = $contentsarr['sections']['section'];
-            $sections = array();
             foreach ($sectionarr as $section) {
                 $section = (object)$section;
                 $section->settings = array();
             foreach ($sectionarr as $section) {
                 $section = (object)$section;
                 $section->settings = array();
@@ -174,7 +175,6 @@ abstract class backup_general_helper extends backup_helper {
         }
         if (isset($contentsarr['activities']) && isset($contentsarr['activities']['activity'])) {
             $activityarr = $contentsarr['activities']['activity'];
         }
         if (isset($contentsarr['activities']) && isset($contentsarr['activities']['activity'])) {
             $activityarr = $contentsarr['activities']['activity'];
-            $activities = array();
             foreach ($activityarr as $activity) {
                 $activity = (object)$activity;
                 $activity->settings = array();
             foreach ($activityarr as $activity) {
                 $activity = (object)$activity;
                 $activity->settings = array();