1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-24 01:44:27 +02:00

MDL-80210 quiz: fix default for reviewmaxmarks when upgrading

It is correct that the database default should be 0, to match
other similar columns, but when sites are upgraded, we need
to set the settings for all existing quizzes to match the previous
behaviour.
This commit is contained in:
Tim Hunt 2023-11-21 17:18:22 +00:00
parent b58d1fd4e2
commit e7ab65f68e
2 changed files with 11 additions and 1 deletions

@ -197,5 +197,15 @@ function xmldb_quiz_upgrade($oldversion) {
// Automatically generated Moodle v4.3.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2023112300) {
// Set the value for all existing rows to match the previous behaviour,
// but only where users have not already set another value.
$DB->set_field('quiz', 'reviewmaxmarks', 0x11110, ['reviewmaxmarks' => 0]);
// Quiz savepoint reached.
upgrade_mod_savepoint(true, 2023112300, 'quiz');
}
return true;
}

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2023100900;
$plugin->version = 2023112300;
$plugin->requires = 2023100400;
$plugin->component = 'mod_quiz';