本文整理汇总了PHP中restore_controller::is_executing方法的典型用法代码示例。如果您正苦于以下问题:PHP restore_controller::is_executing方法的具体用法?PHP restore_controller::is_executing怎么用?PHP restore_controller::is_executing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类restore_controller
的用法示例。
在下文中一共展示了restore_controller::is_executing方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: magic_get_requestorigin
/**
* Returns the origin of current request.
*
* Note: constants are not required because we need to use these values in logging and reports.
*
* @return string 'web', 'ws', 'cli', 'restore', etc.
*/
protected function magic_get_requestorigin()
{
if (class_exists('restore_controller', false) && restore_controller::is_executing()) {
return 'restore';
}
if (WS_SERVER) {
return 'ws';
}
if (CLI_SCRIPT) {
return 'cli';
}
return 'web';
}
示例2: notify_changed
/**
* Used to notify the completion system (if necessary) that a user's grade
* has changed, and clear up a possible score cache.
*
* @param bool $deleted True if grade was actually deleted
*/
function notify_changed($deleted)
{
global $USER, $SESSION, $CFG, $COURSE, $DB;
// Grades may be cached in user session
if ($USER->id == $this->userid) {
unset($SESSION->gradescorecache[$this->itemid]);
}
require_once $CFG->libdir . '/completionlib.php';
// Bail out immediately if completion is not enabled for site (saves loading
// grade item & requiring the restore stuff).
if (!completion_info::is_enabled_for_site()) {
return;
}
// Ignore during restore, as completion data will be updated anyway and
// doing it now will result in incorrect dates (it will say they got the
// grade completion now, instead of the correct time).
if (class_exists('restore_controller', false) && restore_controller::is_executing()) {
return;
}
// Load information about grade item
$this->load_grade_item();
// Only course-modules have completion data
if ($this->grade_item->itemtype != 'mod') {
return;
}
// Use $COURSE if available otherwise get it via item fields
if (!empty($COURSE) && $COURSE->id == $this->grade_item->courseid) {
$course = $COURSE;
} else {
$course = $DB->get_record('course', array('id' => $this->grade_item->courseid));
}
// Bail out if completion is not enabled for course
$completion = new completion_info($course);
if (!$completion->is_enabled()) {
return;
}
// Get course-module
$cm = get_coursemodule_from_instance($this->grade_item->itemmodule, $this->grade_item->iteminstance, $this->grade_item->courseid);
// If the course-module doesn't exist, display a warning...
if (!$cm) {
// ...unless the grade is being deleted in which case it's likely
// that the course-module was just deleted too, so that's okay.
if (!$deleted) {
debugging("Couldn't find course-module for module '" . $this->grade_item->itemmodule . "', instance '" . $this->grade_item->iteminstance . "', course '" . $this->grade_item->courseid . "'");
}
return;
}
// Pass information on to completion system
$completion->inform_grade_changed($cm, $this->grade_item, $this, $deleted);
}
示例3: notify_changed
/**
* Used to notify the completion system (if necessary) that a user's grade
* has changed, and clear up a possible score cache.
*
* @param bool $deleted True if grade was actually deleted
*/
protected function notify_changed($deleted)
{
global $CFG;
// Condition code may cache the grades for conditional availability of
// modules or sections. (This code should use a hook for communication
// with plugin, but hooks are not implemented at time of writing.)
if (!empty($CFG->enableavailability) && class_exists('\\availability_grade\\callbacks')) {
\availability_grade\callbacks::grade_changed($this->userid);
}
require_once $CFG->libdir . '/completionlib.php';
// Bail out immediately if completion is not enabled for site (saves loading
// grade item & requiring the restore stuff).
if (!completion_info::is_enabled_for_site()) {
return;
}
// Ignore during restore, as completion data will be updated anyway and
// doing it now will result in incorrect dates (it will say they got the
// grade completion now, instead of the correct time).
if (class_exists('restore_controller', false) && restore_controller::is_executing()) {
return;
}
// Load information about grade item
$this->load_grade_item();
// Only course-modules have completion data
if ($this->grade_item->itemtype != 'mod') {
return;
}
// Use $COURSE if available otherwise get it via item fields
$course = get_course($this->grade_item->courseid, false);
// Bail out if completion is not enabled for course
$completion = new completion_info($course);
if (!$completion->is_enabled()) {
return;
}
// Get course-module
$cm = get_coursemodule_from_instance($this->grade_item->itemmodule, $this->grade_item->iteminstance, $this->grade_item->courseid);
// If the course-module doesn't exist, display a warning...
if (!$cm) {
// ...unless the grade is being deleted in which case it's likely
// that the course-module was just deleted too, so that's okay.
if (!$deleted) {
debugging("Couldn't find course-module for module '" . $this->grade_item->itemmodule . "', instance '" . $this->grade_item->iteminstance . "', course '" . $this->grade_item->courseid . "'");
}
return;
}
// Pass information on to completion system
$completion->inform_grade_changed($cm, $this->grade_item, $this, $deleted);
}
示例4: update_progress
public function update_progress()
{
$this->executing[] = restore_controller::is_executing();
}