-
Task
-
Resolution: Fixed
-
Minor
-
5.0, 5.1
-
MOODLE_500_STABLE, MOODLE_501_STABLE
-
MOODLE_500_STABLE
-
MDL-85187-main -
-
-
-
1
-
Team Dragons 2025 Sprint 1.4
To have it properly detected for the future, it would be great to add to all the upgrade.php scripts some lines like these:
// Automatically generated Moodle v5.0.0 release upgrade line.
|
// Put any upgrade step following this. |
exactly before the "return true;" present in all the scripts.
Normally, it's ok to do that both in the stable (500_STABLE) and the main branches, so they will allow quickly find where 5.0.0 started and act once we decide future requirements.
But, when under parallel development, this only can be done in the stable (500_STABLE) branch as the main branch already has diverged and can have own upgrade steps not corresponding to the version just released, but to the future version being developed in parallel.
The change can be performed globally with:
#!/bin/bash
|
export rel="5.0.0" && find . -name upgrade.php | \ |
xargs grep -l 'function.*xmldb_.*_upgrade' | \ |
grep '/db/' | \ |
xargs grep -L "Automatically generated Moodle v${rel} release upgrade" | \ |
xargs perl -p -i -e 's@( *)(return true;)@\1// Automatically generated Moodle v$ENV{rel} release upgrade line.\n\1// Put any upgrade step following this.\n\n\1\2@s' |
Command to detect all the upgrade.php files not having those lines:
find . -name upgrade.php | xargs grep -l 'function.*xmldb_.*_upgrade' | grep '/db/' | xargs grep -L 'Automatically generated Moodle v5.0.0 release upgrade' |
Commands to detect that we have not added the lines to incorrect files:
grep -lr 'Automatically generated Moodle v5.0.0 release upgrade' * | grep -v '/db/' |
grep -lr 'Automatically generated Moodle v5.0.0 release upgrade' * | xargs grep -L 'function.*xmldb_.*_upgrade' |
Command to detect if the lines have been added after a post-release upgrade step. If there are upgrade steps found, verify that all of them were already there the day of the release and have not been introduced later (you can look for differences between the release v5.0.0 and the current main branch to verify that)
export rel="5.0.0" && export ver="202504" && |
find . -name upgrade.php | \ |
xargs grep -B25 "Automatically generated Moodle v${rel} release upgrade" | \ |
grep "upgrade_.*_savepoint.*${ver}" |
Important note to integrators: The sooner this issue is integrated after release, the fewer chances to get the lines put in an incorrect place (that's what the last "command to detect" above tries to avoid. We need to ensure that the lines are exactly at the release point (or we may end up deleting upgrade steps incorrectly in the future). So, immediate integration after release (within the on-sync period and ideally before any new upgrade step is added), it the best achievement.
Ciao
- is a clone of
-
MDL-83374 Add Moodle 4.5.0 upgrade line to all the upgrade.php scripts
-
- Closed
-