Permalink
Browse files

MDL-35257 lib: if $CFG->logguests is disabled, avoid some log actions

This is for performance, else there can be great contention on the guest
user record as we've seen on moodle.org.
  • Loading branch information...
danpoltawski committed Sep 5, 2012
1 parent 71e12dc commit bd916ad1ee0227d8c34a42d9e648d7bdb68730f9
Showing with 10 additions and 0 deletions.
  1. +5 −0 lib/datalib.php
  2. +5 −0 lib/moodlelib.php
View
@@ -1764,6 +1764,11 @@ function user_accesstime_log($courseid=0) {
return;
}
+ if (isguestuser()) {
+ // Do not update guest access times/ips for performance.
+ return;
+ }
+
if (empty($courseid)) {
$courseid = SITEID;
}
View
@@ -3289,6 +3289,11 @@ function get_user_key($script, $userid, $instance=null, $iprestriction=null, $va
function update_user_login_times() {
global $USER, $DB;
+ if (isguestuser()) {
+ // Do not update guest access times/ips for performance.
+ return true;
+ }
+
$now = time();
$user = new stdClass();

0 comments on commit bd916ad

Please sign in to comment.