Merge branch 'MDL-54106-master' of https://github.com/lucaboesch/moodle

This commit is contained in:
Damyon Wiese 2017-12-11 11:37:48 +08:00
commit 5ec2ce20f5

View File

@ -51,8 +51,8 @@ class delete_unconfirmed_users_task extends scheduled_task {
$cuttime = $timenow - ($CFG->deleteunconfirmed * 3600);
$rs = $DB->get_recordset_sql ("SELECT *
FROM {user}
WHERE confirmed = 0 AND firstaccess > 0
AND firstaccess < ? AND deleted = 0", array($cuttime));
WHERE confirmed = 0 AND timecreated > 0
AND timecreated < ? AND deleted = 0", array($cuttime));
foreach ($rs as $user) {
delete_user($user); // We MUST delete user properly first.
$DB->delete_records('user', array('id' => $user->id)); // This is a bloody hack, but it might work.