MDL-28180 backup - set excluded activities for any non-course operation
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 11 Dec 2011 20:37:33 +0000 (21:37 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 11 Dec 2011 23:30:58 +0000 (00:30 +0100)
backup/controller/backup_controller.class.php
backup/controller/restore_controller.class.php
backup/util/plan/backup_plan.class.php

index 1bab62b..d6d7bd1 100644 (file)
@@ -293,6 +293,14 @@ class backup_controller extends backup implements loggable {
         // Basic/initial prevention against time/memory limits
         set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
         raise_memory_limit(MEMORY_EXTRA);
+        // If this is not a course backup, inform the plan we are not
+        // including all the activities for sure. This will affect any
+        // task/step executed conditionally to stop including information
+        // for section and activity backup. MDL-28180.
+        if ($this->get_type() !== backup::TYPE_1COURSE) {
+            $this->log('notifying plan about excluded activities by type', backup::LOG_DEBUG);
+            $this->plan->set_excluding_activities();
+        }
         return $this->plan->execute();
     }
 
index 50ec102..680e6e9 100644 (file)
@@ -299,6 +299,14 @@ class restore_controller extends backup implements loggable {
         // Basic/initial prevention against time/memory limits
         set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
         raise_memory_limit(MEMORY_EXTRA);
+        // If this is not a course restore, inform the plan we are not
+        // including all the activities for sure. This will affect any
+        // task/step executed conditionally to stop processing information
+        // for section and activity restore. MDL-28180.
+        if ($this->get_type() !== backup::TYPE_1COURSE) {
+            $this->log('notifying plan about excluded activities by type', backup::LOG_DEBUG);
+            $this->plan->set_excluding_activities();
+        }
         return $this->plan->execute();
     }
 
index f21385c..bf217fd 100644 (file)
@@ -44,6 +44,7 @@ class backup_plan extends base_plan implements loggable {
         }
         $this->controller = $controller;
         $this->basepath   = $CFG->tempdir . '/backup/' . $controller->get_backupid();
+        $this->excludingdactivities = false;
         parent::__construct('backup_plan');
     }