Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-43939

Cleanup tasks on cron broken by self-registration based authentication

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.5.2, 2.6.1
    • Fix Version/s: None
    • Component/s: Authentication
    • Labels:
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE

      Description

      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() !!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              davidaylmer David Aylmer
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: