From 06aa3ac19f1aeef09fbc3e2e64650ed5a163a038 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Mon, 27 Aug 2012 13:32:21 +0800 Subject: [PATCH] MDL-28346 Backup: Restore task can log results --- backup/util/plan/base_task.class.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/backup/util/plan/base_task.class.php b/backup/util/plan/base_task.class.php index 1527634713f..8fe6b5732d9 100644 --- a/backup/util/plan/base_task.class.php +++ b/backup/util/plan/base_task.class.php @@ -191,6 +191,34 @@ abstract class base_task implements checksumable, executable, loggable { backup_general_helper::array_checksum_recursive($this->steps)); } + /** + * Add the given info to the current plan's results. + * + * @see base_plan::add_result() + * @param array $result associative array describing a result of a task/step + */ + public function add_result($result) { + if (!is_null($this->plan)) { + $this->plan->add_result($result); + } else { + debugging('Attempting to add a result of a task not binded with a plan', DEBUG_DEVELOPER); + } + } + + /** + * Return the current plan's results + * + * @return array|null + */ + public function get_results() { + if (!is_null($this->plan)) { + return $this->plan->get_results(); + } else { + debugging('Attempting to get results of a task not binded with a plan', DEBUG_DEVELOPER); + return null; + } + } + // Protected API starts here /**