|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00030 abstract class restore_task extends base_task { 00031 00035 public function __construct($name, $plan = null) { 00036 if (!is_null($plan) && !($plan instanceof restore_plan)) { 00037 throw new restore_task_exception('wrong_restore_plan_specified'); 00038 } 00039 parent::__construct($name, $plan); 00040 } 00041 00042 public function get_restoreid() { 00043 return $this->plan->get_restoreid(); 00044 } 00045 00046 public function get_info() { 00047 return $this->plan->get_info(); 00048 } 00049 00050 public function get_target() { 00051 return $this->plan->get_target(); 00052 } 00053 00054 public function get_userid() { 00055 return $this->plan->get_userid(); 00056 } 00057 00058 public function get_decoder() { 00059 return $this->plan->get_decoder(); 00060 } 00061 00062 public function is_samesite() { 00063 return $this->plan->is_samesite(); 00064 } 00065 00066 public function is_missing_modules() { 00067 return $this->plan->is_missing_modules(); 00068 } 00069 00070 public function is_excluding_activities() { 00071 return $this->plan->is_excluding_activities(); 00072 } 00073 00074 public function set_preloaded_information() { 00075 $this->plan->set_preloaded_information(); 00076 } 00077 00078 public function get_preloaded_information() { 00079 return $this->plan->get_preloaded_information(); 00080 } 00081 00082 public function get_tempdir() { 00083 return $this->plan->get_tempdir(); 00084 } 00085 00086 public function get_old_courseid() { 00087 return $this->plan->get_info()->original_course_id; 00088 } 00089 00090 public function get_old_contextid() { 00091 return $this->plan->get_info()->original_course_contextid; 00092 } 00093 00094 public function get_old_system_contextid() { 00095 return $this->plan->get_info()->original_system_contextid; 00096 } 00097 00102 public function execute_after_restore() { 00103 if ($this->executed) { 00104 foreach ($this->steps as $step) { 00105 if (method_exists($step, 'launch_after_restore_methods')) { 00106 $step->launch_after_restore_methods(); 00107 } 00108 } 00109 } 00110 if ($this->executed && method_exists($this, 'after_restore')) { 00111 $this->after_restore(); 00112 } 00113 } 00114 } 00115 00116 /* 00117 * Exception class used by all the @restore_task stuff 00118 */ 00119 class restore_task_exception extends base_task_exception { 00120 00121 public function __construct($errorcode, $a=NULL, $debuginfo=null) { 00122 parent::__construct($errorcode, $a, $debuginfo); 00123 } 00124 }