MDL-21432 backup - minor improvements to builders
authorEloy Lafuente <stronk7@moodle.org>
Tue, 27 Jul 2010 23:33:31 +0000 (23:33 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Tue, 27 Jul 2010 23:33:31 +0000 (23:33 +0000)
backup/moodle2/backup_plan_builder.class.php
backup/moodle2/restore_plan_builder.class.php

index f030c42..9066338 100644 (file)
@@ -22,6 +22,8 @@
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+defined('MOODLE_INTERNAL') || die();
+
 require_once($CFG->dirroot . '/backup/moodle2/backup_root_task.class.php');
 require_once($CFG->dirroot . '/backup/moodle2/backup_activity_task.class.php');
 require_once($CFG->dirroot . '/backup/moodle2/backup_section_task.class.php');
@@ -38,8 +40,11 @@ require_once($CFG->dirroot . '/backup/moodle2/backup_custom_fields.php');
 // Load all the activity tasks for moodle2 format
 $mods = get_plugin_list('mod');
 foreach ($mods as $mod => $moddir) {
+    $taskpath = $moddir . '/backup/moodle2/backup_' . $mod . '_activity_task.class.php';
     if (plugin_supports('mod', $mod, FEATURE_BACKUP_MOODLE2)) {
-        require_once($moddir . '/backup/moodle2/backup_' . $mod . '_activity_task.class.php');
+        if (file_exists($taskpath)) {
+            require_once($taskpath);
+        }
     }
 }
 
index cdc192e..025922d 100644 (file)
@@ -22,6 +22,8 @@
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+defined('MOODLE_INTERNAL') || die();
+
 require_once($CFG->dirroot . '/backup/moodle2/restore_root_task.class.php');
 require_once($CFG->dirroot . '/backup/moodle2/restore_course_task.class.php');
 require_once($CFG->dirroot . '/backup/moodle2/restore_section_task.class.php');
@@ -117,7 +119,7 @@ abstract class restore_plan_builder {
             $blocks = backup_general_helper::get_blocks_from_path($task->get_taskbasepath());
             foreach ($blocks as $basepath => $name) {
                 if ($task = restore_factory::get_restore_block_task($name, $basepath)) {
-                    //$plan->add_task($task);
+                    $plan->add_task($task);
                 } else {
                     // TODO: Debug information about block not supported
                 }