mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-63716 course: less user_accesstime_log() calls
We should only call this function when a user actually views a course. It is not called automatically when a course context is validated from a webservice. It is called directly from the core_course_view_course webservice.
This commit is contained in:
parent
208950cff0
commit
160e77f9d0
@ -26,6 +26,7 @@ defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
require_once($CFG->libdir.'/completionlib.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once($CFG->libdir.'/datalib.php');
|
||||
require_once($CFG->dirroot.'/course/format/lib.php');
|
||||
|
||||
define('COURSE_MAX_LOGS_PER_PAGE', 1000); // Records.
|
||||
@ -3665,6 +3666,8 @@ function course_view($context, $sectionnumber = 0) {
|
||||
|
||||
$event = \core\event\course_viewed::create($eventdata);
|
||||
$event->trigger();
|
||||
|
||||
user_accesstime_log($context->instanceid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2763,7 +2763,10 @@ function require_login($courseorid = null, $autologinguest = true, $cm = null, $
|
||||
$PAGE->set_course($course);
|
||||
}
|
||||
// Set accesstime or the user will appear offline which messes up messaging.
|
||||
user_accesstime_log($course->id);
|
||||
// Do not update access time for webservice or ajax requests.
|
||||
if (!WS_SERVER && !AJAX_SCRIPT) {
|
||||
user_accesstime_log($course->id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2972,7 +2975,10 @@ function require_login($courseorid = null, $autologinguest = true, $cm = null, $
|
||||
}
|
||||
|
||||
// Finally access granted, update lastaccess times.
|
||||
user_accesstime_log($course->id);
|
||||
// Do not update access time for webservice or ajax requests.
|
||||
if (!WS_SERVER && !AJAX_SCRIPT) {
|
||||
user_accesstime_log($course->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -165,6 +165,7 @@ the groupid field.
|
||||
until all settings have been set. The additional parameters are used recursively and shouldn't be need to be explicitly passed in when calling
|
||||
the function from other parts of Moodle.
|
||||
The return value: $settingsoutput is an array of setting names and the values that were set by the function.
|
||||
* Webservices no longer update the lastaccess time for a user in a course. Call core_course_view_course() manually if needed.
|
||||
|
||||
=== 3.5 ===
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user