mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Fixed longtimenosee unenrolments. user_lastaccess and role_assignments were growing with uneccessary entries, to the point where memory limits were reached and in the end NO unenrolments were happening at all.
See MDL-11571
This commit is contained in:
parent
ece966f06e
commit
1afb11e70b
@ -199,8 +199,8 @@
|
||||
if ($assigns = get_users_longtimenosee($longtime)) {
|
||||
foreach ($assigns as $assign) {
|
||||
if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) {
|
||||
if (role_unassign(0, $assign->id, 0, $context->id)) {
|
||||
mtrace("Deleted assignment for user $assign->id from course $assign->courseid");
|
||||
if (role_unassign(0, $assign->userid, 0, $context->id)) {
|
||||
mtrace("Deleted assignment for user $assign->userid from course $assign->courseid");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -474,4 +474,4 @@
|
||||
echo "</xmp>";
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -354,10 +354,9 @@ function get_users_unconfirmed($cutofftime=2000000000) {
|
||||
*/
|
||||
function get_users_longtimenosee($cutofftime) {
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT userid as id, courseid
|
||||
return get_records_sql("SELECT id, userid, courseid
|
||||
FROM {$CFG->prefix}user_lastaccess
|
||||
WHERE courseid != ".SITEID."
|
||||
AND timeaccess > 0
|
||||
AND timeaccess < $cutofftime ");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user