MDL-21432 backup - complete standard/course outcomes backup & restore
[moodle.git] / backup / moodle2 / restore_root_task.class.php
index 4c3aaed..98128fe 100644 (file)
@@ -34,7 +34,41 @@ class restore_root_task extends restore_task {
      */
     public function build() {
 
-        // TODO: Link all the preloading/precreation steps here
+        // Conditionally create the temp table (can exist from prechecks) and delete old stuff
+        $this->add_step(new restore_create_and_clean_temp_stuff('create_and_clean_temp_stuff'));
+
+        // If we haven't preloaded information, load all the included inforef records to temp_ids table
+        $this->add_step(new restore_load_included_inforef_records('load_inforef_records'));
+
+        // If we haven't preloaded information, load all the needed roles to temp_ids_table
+        $this->add_step(new restore_load_and_map_roles('load_and_map_roles'));
+
+        // If we haven't preloaded information and are restoring user info, load all the needed users to temp_ids table
+        $this->add_step(new restore_load_included_users('load_user_records'));
+
+        // If we haven't preloaded information and are restoring user info, process all those needed users
+        // creating/mapping them as needed. Any problem here will cause exception as far as prechecks have
+        // performed the same process so, it's not possible to have errors here
+        $this->add_step(new restore_process_included_users('process_user_records'));
+
+        // Load all the needed files to temp_ids table
+        $this->add_step(new restore_load_included_files('load_file_records', 'files.xml'));
+
+        // Unconditionally, create all the needed users calculated in the previous step
+        $this->add_step(new restore_create_included_users('create_users'));
+
+        // Unconditionally, load create all the needed groups and groupings
+        $this->add_step(new restore_groups_structure_step('create_groups_and_groupings', 'groups.xml'));
+
+        // Unconditionally, load create all the needed scales
+        $this->add_step(new restore_scales_structure_step('create_scales', 'scales.xml'));
+
+        // Unconditionally, load create all the needed outcomes
+        $this->add_step(new restore_outcomes_structure_step('create_scales', 'outcomes.xml'));
+
+        // Unconditionally, load create all the needed outcomes.
+        // TODO: restore outcomes
+        // $this->add_step(new restore_outcomes_structure_step('create_outcomes', 'outcomes.xml'));
 
         // At the end, mark it as built
         $this->built = true;