mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-22145 backup storage - provide 'user_tohub' storage for HUB files
This commit is contained in:
parent
96449a1698
commit
ce937f9957
11 changed files with 131 additions and 12 deletions
|
@ -31,7 +31,7 @@ abstract class backup_execution_step extends backup_step {
|
|||
|
||||
public function execute() {
|
||||
// Simple, for now
|
||||
$this->define_execution();
|
||||
return $this->define_execution();
|
||||
}
|
||||
|
||||
// Protected API starts here
|
||||
|
|
|
@ -32,6 +32,7 @@ abstract class base_plan implements checksumable, executable {
|
|||
protected $name; // One simple name for identification purposes
|
||||
protected $settings; // One array of (accumulated from tasks) base_setting elements
|
||||
protected $tasks; // One array of base_task elements
|
||||
protected $results; // One array of results received from tasks
|
||||
|
||||
protected $built; // Flag to know if one plan has been built
|
||||
|
||||
|
@ -42,6 +43,7 @@ abstract class base_plan implements checksumable, executable {
|
|||
$this->name = $name;
|
||||
$this->settings = array();
|
||||
$this->tasks = array();
|
||||
$this->results = array();
|
||||
$this->built = false;
|
||||
}
|
||||
|
||||
|
@ -68,6 +70,14 @@ abstract class base_plan implements checksumable, executable {
|
|||
return $this->tasks;
|
||||
}
|
||||
|
||||
public function add_result($result) {
|
||||
$this->results = array_merge($this->results, $result);
|
||||
}
|
||||
|
||||
public function get_results() {
|
||||
return $this->results;
|
||||
}
|
||||
|
||||
public function get_settings() {
|
||||
return $this->settings;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,12 @@ abstract class base_task implements checksumable, executable, loggable {
|
|||
throw new base_task_exception('base_task_not_built', $this->name);
|
||||
}
|
||||
foreach ($this->steps as $step) {
|
||||
$step->execute();
|
||||
$result = $step->execute();
|
||||
// If step returns array, it will be forwarded to plan
|
||||
// (TODO: shouldn't be array but proper result object)
|
||||
if (is_array($result) and !empty($result)) {
|
||||
$this->plan->add_result($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue