Pre-requisites
Site setup with at least 2 containers/servers, container 1 used for CLI administration, container 2 for web access.
Run a clean upgrade to setup initial component hash state
1. Edit top level version.php and bump it by .01
2. In container 1, execute `php admin/cli/upgrade.php` and complete the upgrade.
Test upgrade status with existing options - /db/ unchanged
3. Edit mod/assign/version.php and bump it by 1
4. In container 1, execute `php admin/cli/upgrade.php --is-pending`
5. Confirm upgrade is pending.
Test upgrade status with new options - /db/ unchanged
6. In container 1, execute `php admin/cli/upgrade.php --is-maintenance-required`
7. Confirm maintenance is NOT required for this upgrade, and an upgrade is still pending.
8. In browser, visit admin/index.php on container 2, as a site administrator.
9. Confirm you are prompted to upgrade, but do not do it.
Test upgrade UI locking.
10. In container 1, execute `php admin/cli/upgrade.php --is-maintenance-required --set-ui-upgrade-lock`
11. In browser, visit admin/index.php on container 2, as a site administrator.
12. Confirm your are NOT prompted to upgrade, and can click around as normal.
13. In container 1, execute `php admin/cli/upgrade.php --is-maintenance-required --unset-ui-upgrade-lock`
14. In browser, visit admin/index.php on container 2, as a site administrator.
15. Confirm you ARE prompted to upgrade, but do not do it.
Test upgrade status with no existing options - /db/ changed
16. Edit /mod/assign/db/tasks.php and change anything in the file, such as setting the minute to '1' instead of '*'
17. In container 1, execute `php admin/cli/upgrade.php --is-pending`
18. Confirm an upgrade IS pending.
Test upgrade status with new options - /db/ changed
19. In container 1, execute `php admin/cli/upgrade.php --is-maintenance-required`
20. Confirm maintenance IS required for this upgrade.
Test upgrade blocking still works
21. Edit lib/upgradelib.php. Find function upgrade_noncore, and add a line immediately after the line `upgrade_started();`
`sleep(10000);`
22. In container 1, execute `php admin/cli/upgrade.php`, then accept the upgrade. This will enter an long sleep while the site upgrades.
23. In browser, visit admin/index.php on container 2, as a site administrator.
24. Confirm you see the 'Site is being upgraded' error message.
25. Cancel the upgrade in CLI with the cancel command for the OS.
26. Revert the change to /mod/assign/db/tasks.php
Test upgrade isn't blocked with new options - /db/ unchanged
27. In container 1, run `php admin/cli/upgrade.php --no-maintenance --set-ui-upgrade-lock`, the accept the upgrade.
28. In browser, visit admin/index.php and confirm the site is not in maintenance, and you can click around.
29. Cancel the upgrade in CLI with the cancel command for the OS.
Test upgrade is blocked with new options - /db/ changed
30. Edit /mod/assign/db/tasks.php and change anything in the file, such as setting the minute to '1' instead of '*'
31. In container 1, run `php admin/cli/upgrade.php --no-maintenance`
32. Confirm that you are informed the upgrade WILL need maintenance, and no upgrade is started or performed.
33. Revert the change to /mod/assign/db/tasks.php
Test upgrade completes without maintenance.
34. Remove the `sleep(10000);` line from lib/upgradelib.php
35. In container 1, run `php admin/cli/upgrade.php --no-maintenance --set-ui-upgrade-lock`, and accept the upgrade.
36. Confirm the upgrade successfully completes.
37. Confirm that the command to purge caches are displayed.