MDL-21432 backup - root task, inforef and users handling completed, various fixes
This commit is contained in:
@@ -89,6 +89,46 @@ class backup_section_task extends backup_task {
|
||||
$this->built = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exceptionally override the execute method, so, based in the section_included setting, we are able
|
||||
* to skip the execution of one task completely
|
||||
*/
|
||||
public function execute() {
|
||||
|
||||
// Find section_included_setting
|
||||
if (!$this->get_setting_value('included')) {
|
||||
$this->log('section skipped by _included setting', backup::LOG_DEBUG, $this->name);
|
||||
|
||||
} else { // Setting tells us it's ok to execute
|
||||
parent::execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialisation that, first of all, looks for the setting within
|
||||
* the task with the the prefix added and later, delegates to parent
|
||||
* without adding anything
|
||||
*/
|
||||
public function get_setting($name) {
|
||||
$namewithprefix = 'section_' . $this->sectionid . '_' . $name;
|
||||
$result = null;
|
||||
foreach ($this->settings as $key => $setting) {
|
||||
if ($setting->get_name() == $namewithprefix) {
|
||||
if ($result != null) {
|
||||
throw new base_task_exception('multiple_settings_by_name_found', $namewithprefix);
|
||||
} else {
|
||||
$result = $setting;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($result) {
|
||||
return $result;
|
||||
} else {
|
||||
// Fallback to parent
|
||||
return parent::get_setting($name);
|
||||
}
|
||||
}
|
||||
|
||||
// Protected API starts here
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user