// Define sources
//Include manual, category and the course grade item
- $grade_items_sql ="SELECT * FROM {grade_items}
+ $grade_items_sql ="SELECT * FROM {grade_items}
WHERE courseid = :courseid
AND (itemtype='manual' OR itemtype='course' OR itemtype='category')";
$grade_items_params = array('courseid'=>backup::VAR_COURSEID);
// Find activity_included_setting
if (!$this->get_setting_value('included')) {
$this->log('activity skipped by _included setting', backup::LOG_DEBUG, $this->name);
+ $this->plan->set_excluding_activities(); // Inform plan we are excluding actvities
} else { // Setting tells us it's ok to execute
parent::execute();
return false;
}
+ // Some module present in backup file isn't available to restore
+ // in this site, don't execute
+ if ($this->task->is_missing_modules()) {
+ return false;
+ }
+
+ // Some activity has been excluded to be restored, don't execute
+ if ($this->task->is_excluding_activities()) {
+ return false;
+ }
+
// Arrived here, execute the step
return true;
}
protected $basepath; // Fullpath to dir where backup is available
protected $preloaded; // When executing the plan, do we have preloaded (from checks) info
protected $decoder; // restore_decode_processor in charge of decoding all the interlinks
+ protected $missingmodules; // to flag if restore has detected some missing module
+ protected $excludingdactivities; // to flag if restore settings are excluding any activity
/**
* Constructor - instantiates one object of this class
$this->basepath = $CFG->dataroot . '/temp/backup/' . $controller->get_tempdir();
$this->preloaded = false;
$this->decoder = new restore_decode_processor($this->get_restoreid(), $this->get_info()->original_wwwroot, $CFG->wwwroot);
+ $this->missingmodules = false;
+ $this->excludingdactivities = false;
+
parent::__construct('restore_plan');
}
return $this->controller->is_samesite();
}
+ public function is_missing_modules() {
+ return $this->missingmodules;
+ }
+
+ public function is_excluding_activities() {
+ return $this->excludingdactivities;
+ }
+
public function set_preloaded_information() {
$this->preloaded = true;
}
return $this->controller->get_tempdir();
}
+ public function set_missing_modules() {
+ $this->missingmodules = true;
+ }
+
+ public function set_excluding_activities() {
+ $this->excludingdactivities = true;
+ }
+
public function log($message, $level, $a = null, $depth = null, $display = false) {
backup_helper::log($message, $level, $a, $depth, $display, $this->get_logger());
}
return $this->plan->is_samesite();
}
+ public function is_missing_modules() {
+ return $this->plan->is_missing_modules();
+ }
+
+ public function is_excluding_activities() {
+ return $this->plan->is_excluding_activities();
+ }
+
public function set_preloaded_information() {
$this->plan->set_preloaded_information();
}