From 184acafab6a3b6d0b7de29f75dbd59a044797c6d Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sun, 11 Dec 2011 21:37:33 +0100 Subject: [PATCH] MDL-28180 backup - set excluded activities for any non-course operation --- backup/controller/backup_controller.class.php | 8 ++++++++ backup/controller/restore_controller.class.php | 8 ++++++++ backup/util/plan/backup_plan.class.php | 1 + 3 files changed, 17 insertions(+) diff --git a/backup/controller/backup_controller.class.php b/backup/controller/backup_controller.class.php index 1bab62be627..d6d7bd1d6a1 100644 --- a/backup/controller/backup_controller.class.php +++ b/backup/controller/backup_controller.class.php @@ -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(); } diff --git a/backup/controller/restore_controller.class.php b/backup/controller/restore_controller.class.php index 50ec1027d02..680e6e9d95f 100644 --- a/backup/controller/restore_controller.class.php +++ b/backup/controller/restore_controller.class.php @@ -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(); } diff --git a/backup/util/plan/backup_plan.class.php b/backup/util/plan/backup_plan.class.php index f21385cc5f4..bf217fd9c10 100644 --- a/backup/util/plan/backup_plan.class.php +++ b/backup/util/plan/backup_plan.class.php @@ -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'); }