Skip to content

Commit

Permalink
More efficiency when deleting enrolments
Browse files Browse the repository at this point in the history
  • Loading branch information
martin committed Aug 5, 2002
1 parent f282e63 commit 3d7a585
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions admin/cron.php
Expand Up @@ -43,9 +43,10 @@

if ($CFG->longtimenosee) { // value in days
$cutofftime = time() - ($CFG->longtimenosee * 3600 * 24);
if ($users = get_records_sql("SELECT * FROM user
if ($users = get_records_sql("SELECT u.* FROM user u, user_students s
WHERE lastaccess > '0' AND
lastaccess < '$cutofftime'")) {
lastaccess < '$cutofftime'
u.id = s.user GROUP BY u.id")) {
foreach ($users as $user) {
if (delete_records("user_students", "user", $user->id)) {
echo "Deleted student enrolment for $user->firstname $user->lastname ($user->id)\n";
Expand Down

0 comments on commit 3d7a585

Please sign in to comment.