-
Bug
-
Resolution: Fixed
-
Minor
-
2.3.4, 2.4.1, 2.5
-
MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
-
MOODLE_23_STABLE, MOODLE_24_STABLE
-
Here is some brilliant detective work by derekw:
Say the the current block version is 1, the upgrade.php version is 2, version.php is 3 and current block cron is 0 and version.php cron is 1. the sequence of code in upgrade_plugins_blocks is:
i) current block version (1) < version.php (3) so upgrade function executed
ii) upgrade function updates block version to the value in upgrade.php (2)
ii) current block data is re-read from database
iii) current block version (2) < version.php (3) so block version updated to value in version.php (3)
iv) current block cron (0) < version.php cron (1) so current block written to database with cron value
in version.php (1) * BUT this also sets block version number in database back to (2) *
Therefore the version number in the current block variable ($currblock) needs setting to the value from version.php before the block is updated with the cron value. I suggest the code change, which should be after the upgrade_block_savepoint before the cron update should be either to re-read $currblock from the database or set $currblock->version = $block->version.
I prefer the later looking at the upgrade_block_savepoint function.