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

Way to find which users were created during course restore process

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.8.2, 3.10, 4.0
    • Fix Version/s: None
    • Component/s: Backup
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_38_STABLE, MOODLE_400_STABLE

      Description

      The "user_created" event is not triggered during course restore on purpose, restore process does not trigger any core events.
      There is a "course_restored" event that can be observed, however there is no way/API currently to find the list of created users (or modules, etc)

      From conversation with Eloy Lafuente (stronk7)

      Eloy Lafuente Plaza, [6 Apr 2020 at 10:53:53]:
      so there are 2 alternatives:

      • or we create that new user_created_on_reastore event
      • or we use something into temp tables to have them at hand and we observe the course_restored event.

      Marina, [6 Apr 2020 at 10:54:57]:
      ok thanks

      it is ok to add methods to course_restored event class to find relevant data? Like list of created users for example

      these methods can only be used inside event observers

      Eloy Lafuente Plaza, [6 Apr 2020 at 10:56:23]:
      doesn't sound wrong, is my first thought.

      can be useful to others observing the same event. Just hope it doesn't end being a spaghetti/monster event (then maybe we should consider moving it apart)

      Marina, [6 Apr 2020 at 10:59:22]:
      is it possible that there is a scenario when users are created during restore process but then another error occurs and course is not restored and course_restored event is not triggered?

      Eloy Lafuente Plaza, [6 Apr 2020 at 11:01:42]:
      uff, everything is possible 🙂 I don't think we run restore under transaction ...

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              marina Marina Glancy
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              3 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 - 10 minutes
                  10m