It would be very useful to be able to schedule a course reset to happen at some specified time in the future.
The two main use cases I can see for this are:
- end users often reset their course at the end in preparation for a new cohort. They may want, for example, to remove all users as soon as a course ends and not have to schedule a reminder to do this manually.
- for developers / system admins: many institutions have "rollover" scripts which prepare a large number of courses for use in the next academic year / term. Rather than have to maintain custom scripts to reset courses in bulk it would be preferable to simply set up a scheduled reset with the correct parameters and let Moodle run the reset properly
A basic implementation of this would involve something like this:
- Add database table(s) to hold the parameters from the reset form
- Add an extra option to the reset form to decide whether to "run now" or "schedule".
- Create a scheduled task to find scheduled resets that are due to be run and call reset_course_userdata() with the stored data
- Most (?) plugins only give the option to reset all instances, but some (e.g. feedback) allow users to select individual instances. What would happen to instances added after the reset was scheduled, but before it was run?
- Could more than one reset be scheduled at any given time? Where / how would the list be displayed to the user?