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

Upgrade throws exception if there are no site admins

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_37_STABLE

      Description

      Moodle allows admins to delete themselves in 2 different ways:

       

      1) GDPR deletion, info at MDL-64718

      2) A Moodle backup restore that includes user information: details unknown, but we see this all the time in MoodleCloud where the only site admin has deleted=1, the username is changed from "admin" to "old@email.address.1562995093" and email is changed to a hash of some sort (this is what restore does i think?)

       

      We then run the CLI upgrade script which triggers an exception on this line:

      // log in as admin - we need doanything permission when applying defaults
      \core\session\manager::set_user(get_admin());

       

      !!! Exception - Argument 1 passed to core\\session
      manager::set_user() must be an instance of stdClass, boolean given, called in [dirroot]/admin/cli/upgrade.php on line 189 !!!

       

        

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            jtomkinson Jordan Tomkinson
            Participants:
            Component watchers:
            Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 minute
                1m