-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
2.5.2, 2.6.1
-
MOODLE_25_STABLE, MOODLE_26_STABLE
If a user self registers, never confirms, and is deleted before the "delete unconfirmed users" period expires, the clean-up tasks will error with a fatal: "!!! Invalid User !!!"
Steps to reproduce
1. A user self registers but never logs in. (Never confirms)
2. The user is manually deleted within the deleteunconfirmed * 3600 timeperiod (7 days default).
3. After the 7 days cron attempts to delete the already deleted user and fails
4. Clean up tasks never get run on the site
Suggested fix.
Following "Running clean-up tasks..." in cronlib there is another task "Delete users who haven't confirmed within required period" that contains the following SQL:
SELECT *
FROM mdl_user
WHERE confirmed = 0 AND firstaccess > 0 AND firstaccess < ?
Solution:
Add: "AND deleted = 0" to the above query
Stack trace:
Error code: invaliduser !!
!! Stack trace: * line 1390 of \lib\dml\moodle_database.php: dml_missing_record_exception thrown
- line 1366 of \lib\dml\moodle_database.php: call to moodle_database->get_record_select()
- line 6373 of \lib\accesslib.php: call to moodle_database->get_record()
- line 4188 of \lib\moodlelib.php: call to context_user::instance()
- line 86 of \lib\cronlib.php: call to delete_user()
- line 61 of \admin\cli\cron.php: call to cron_run() !!
- duplicates
-
MDL-45527 cron task fails : \\core\\task\\delete_unconfirmed_users_task
-
- Closed
-