Permalink
Browse files

More efficiency when deleting enrolments

  • Loading branch information...
1 parent f282e63 commit 3d7a5858348a10b633c299465e41315f677aabc9 martin committed Aug 5, 2002
Showing with 3 additions and 2 deletions.
  1. +3 −2 admin/cron.php
View
@@ -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";

0 comments on commit 3d7a585

Please sign in to comment.