当前位置: 首页>>代码示例>>PHP>>正文


PHP restore_controller::set_status方法代码示例

本文整理汇总了PHP中restore_controller::set_status方法的典型用法代码示例。如果您正苦于以下问题:PHP restore_controller::set_status方法的具体用法?PHP restore_controller::set_status怎么用?PHP restore_controller::set_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在restore_controller的用法示例。


在下文中一共展示了restore_controller::set_status方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * 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);
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:12,代码来源:restore_plan.class.php

示例2: execute

 /**
  * 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);
     events_trigger('course_restored', (object) array('courseid' => $this->get_courseid(), 'userid' => $this->get_userid(), '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()));
 }
开发者ID:Burick,项目名称:moodle,代码行数:13,代码来源:restore_plan.class.php

示例3: execute

 /**
  * 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();
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:15,代码来源:restore_plan.class.php

示例4: execute

 /**
  * 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();
     }
 }
开发者ID:dg711,项目名称:moodle,代码行数:24,代码来源:restore_plan.class.php

示例5: apply_preset

 /**
  *
  */
 public function apply_preset($userpreset, $torestorer = true)
 {
     global $DB, $CFG, $USER;
     $df = mod_dataform_dataform::instance($this->_dataformid);
     // Extract the backup file to the temp folder.
     $folder = 'tmp-' . $df->context->id . '-' . time();
     $backuptempdir = make_temp_directory("backup/{$folder}");
     $fs = get_file_storage();
     $file = $fs->get_file_by_id($userpreset);
     $zipper = get_file_packer($file->get_mimetype());
     $file->extract_to_pathname($zipper, $backuptempdir);
     require_once "{$CFG->dirroot}/backup/util/includes/restore_includes.php";
     // Required preparation due to restorer assumption that this should be a new activity
     // Anonymous users cleanup.
     $DB->delete_records_select('user', $DB->sql_like('firstname', '?'), array('%anonfirstname%'));
     // Grading area removal.
     $DB->delete_records('grading_areas', array('contextid' => $df->context->id));
     $transaction = $DB->start_delegated_transaction();
     $rc = new restore_controller($folder, $df->course->id, backup::INTERACTIVE_NO, backup::MODE_GENERAL, $USER->id, backup::TARGET_CURRENT_ADDING);
     if (!$rc->execute_precheck()) {
         $precheckresults = $rc->get_precheck_results();
         if (is_array($precheckresults) && !empty($precheckresults['errors'])) {
             if (empty($CFG->keeptempdirectoriesonbackup)) {
                 fulldelete($backuptempdir);
             }
         }
     }
     // Get the dataform restore activity task.
     $tasks = $rc->get_plan()->get_tasks();
     $dataformtask = null;
     foreach ($tasks as &$task) {
         if ($task instanceof restore_dataform_activity_task) {
             $dataformtask =& $task;
             break;
         }
     }
     if ($dataformtask) {
         $dataformtask->set_activityid($df->id);
         $dataformtask->set_moduleid($df->cm->id);
         $dataformtask->set_contextid($df->context->id);
         if ($torestorer) {
             $dataformtask->set_ownerid($USER->id);
         }
         $rc->set_status(backup::STATUS_AWAITING);
         $rc->execute_plan();
         $transaction->allow_commit();
         // Rc cleanup.
         $rc->destroy();
         // Anonymous users cleanup.
         $DB->delete_records_select('user', $DB->sql_like('firstname', '?'), array('%anonfirstname%'));
         return true;
     } else {
         $rc->destroy();
     }
     return false;
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:59,代码来源:preset_manager.php


注:本文中的restore_controller::set_status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。