コード例 #1
0
 /**
  * Function responsible for executing the tasks of any plan
  */
 public function execute()
 {
     if ($this->controller->get_status() != backup::STATUS_AWAITING) {
         throw new restore_controller_exception('restore_not_executable_awaiting_required', $this->controller->get_status());
     }
     $this->controller->set_status(backup::STATUS_EXECUTING);
     parent::execute();
     $this->controller->set_status(backup::STATUS_FINISHED_OK);
     // Trigger a course restored event.
     $event = \core\event\course_restored::create(array('objectid' => $this->get_courseid(), 'userid' => $this->get_userid(), 'context' => context_course::instance($this->get_courseid()), 'other' => array('type' => $this->controller->get_type(), 'target' => $this->controller->get_target(), 'mode' => $this->controller->get_mode(), 'operation' => $this->controller->get_operation(), 'samesite' => $this->controller->is_samesite())));
     $event->trigger();
 }
コード例 #2
0
ファイル: restore_plan.class.php プロジェクト: dg711/moodle
 /**
  * Function responsible for executing the tasks of any plan
  */
 public function execute()
 {
     if ($this->controller->get_status() != backup::STATUS_AWAITING) {
         throw new restore_controller_exception('restore_not_executable_awaiting_required', $this->controller->get_status());
     }
     $this->controller->set_status(backup::STATUS_EXECUTING);
     parent::execute();
     $this->controller->set_status(backup::STATUS_FINISHED_OK);
     // Check if we are restoring a course.
     if ($this->controller->get_type() === backup::TYPE_1COURSE) {
         // Check to see if we are on the same site to pass original course info.
         $issamesite = $this->controller->is_samesite();
         $otherarray = array('type' => $this->controller->get_type(), 'target' => $this->controller->get_target(), 'mode' => $this->controller->get_mode(), 'operation' => $this->controller->get_operation(), 'samesite' => $issamesite);
         if ($this->controller->is_samesite()) {
             $otherarray['originalcourseid'] = $this->controller->get_info()->original_course_id;
         }
         // Trigger a course restored event.
         $event = \core\event\course_restored::create(array('objectid' => $this->get_courseid(), 'userid' => $this->get_userid(), 'context' => context_course::instance($this->get_courseid()), 'other' => $otherarray));
         $event->trigger();
     }
 }
コード例 #3
0
 /**
  * Called when course_restored event happens.
  *
  * @param \core\event\course_restored $event Event data object
  */
 public static function course_restored(\core\event\course_restored $event)
 {
     year_tables::handle_new_course($event->get_data()['objectid']);
 }