diff --git a/lib/datalib.php b/lib/datalib.php index 28c6c030c6c..80f09e81bb8 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -1468,9 +1468,9 @@ function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user echo '

Error: Could not insert a new entry to the Moodle log

'; // Don't throw an error } -/// Store lastaccess times for the current user +/// Store lastaccess times for the current user, do not use in cron and other commandline scripts - if (!empty($USER->id) && ($userid == $USER->id) ) { + if (!empty($USER->id) && ($userid == $USER->id) && !defined('FULLME')) { $db->Execute('UPDATE '. $CFG->prefix .'user SET lastip=\''. $REMOTE_ADDR .'\', lastaccess=\''. $timenow .'\' WHERE id = \''. $userid .'\' '); diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 5fd4e4fda72..fecff4d2987 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -451,7 +451,6 @@ function forum_cron() { mtrace(' sent.'); } } - unset ($USER); } }