I am performing a major Moodle upgrade test and encountered an issue related to unexpected email after restoring an old database. I’m looking for best-practice guidance.
Upgrade Scope
Moodle: 4.1 → 4.5
Operating System: Ubuntu 20.04 → Ubuntu 24.04
PHP: 8.1 → 8.3
MariaDB: 10.4 → 11.4
Test Architecture
Test environment deployed using Virtual Machine Manager (KVM/QEMU)
Isolated VM (non-production) local machinr MINT OS
Fresh OS and LAMP stack installed
No external SMTP intentionally configured for testing
Steps Performed
Installed Moodle 4.5 on Ubuntu 24.04.
Restored moodledata directory from production backup.
Restored production database (originally from Moodle 4.1).
Updated
config.phpwith:set a cron job in installation step
Issue Encountered
After completing the database restoration and config.php configuration:
A large number of old email were sent to users.
These notifications appear to be related to scheduled tasks / adhoc tasks / message queues/ Course expire notice from the restored database.
Once the issue was noticed, I powered off the virtual machine immediately.
Questions
What is the correct way to prevent old notifications/emails from being sent after a database restore?
Is there a recommended procedure for restoring production databases into a test environment during major upgrades?
Are there specific Moodle tables that should be cleaned or disabled before first access?
This incident occurred only in the test VM, but I want to ensure the production upgrade is done safely.
Any advice or best-practice documentation would be greatly appreciated.
Thank you in advance.