Moodle reset (php scripts)
Overview
The principle behind this process is to provide schools with a standard process to reset their Moodle site at the end of each school year. The tools / options listed are designed to reset the database to clean up files (e.g. Reduce disk space / increase performance) while keeping the core of the system (e.g. courses / staff) intact.
The traditional way to accomplish a "fresh start" is to re-install Moodle and then re-install all the courses. But this takes a great deal of time in that courses, categories, and teachers have to be reloaded, then themes re-installed, groups set up etc. To help avoid this and still get a clean starting point, we are supplying processes that can be done (any or all can be used at your discretion).
Please understand that WCLN R&D hopes to support local server admins by providing these tools with the following understandings.
These should be implemented by a server technician who will:
- do a site backup prior to implementing any script.
- read the documentation below carefully.
- understand the process and outcomes of these scripts
- take responsibility for their own site
Note that that the preview versions of the files can be used to test prior to running the actual script.
Processes (click to download reset.zip):
1. Remove all student accounts (keeping teachers).
- Site Admin > Users > Accounts > Bulk user actions
- Used filter = "Course role is "Student" in any course from any category" > Add All
- Delete users & Confirm
2. Reset all courses to remove accumulated data:
Script = group_reset.php |
What this script does:
|
Instructions:
|
3. Clear out logs & backup files:
Script = clear_logs.php & clear_backups.php |
What this script does:
|
Instructions:
|
4. Once these are done, you need to clear three tables (if Moodle doesn't reset them):
- mdl_question_attempts
- mdl_question_attempt_steps
- mdl_question_attempt_steps_data
After these resets, run any Moodle upgrades, then load in the new courses.