From dfb53aac59cac4c70a0d515af244e1eac510bc39 Mon Sep 17 00:00:00 2001 From: Marcus Green Date: Fri, 28 Jul 2023 21:04:15 +0100 Subject: [PATCH] reinstate creation of letterhints from upgrades before v1.97 --- changelog.md | 3 +++ db/upgrade.php | 8 ++++++++ version.php | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 636bb1f..8202c0d 100755 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,9 @@ Fix for PHP 8.1 deprecation messages. Thanks to Joseph Rézeau for creating the ticket for that. https://github.com/marcusgreen/moodle-qtype_gapfill/issues/104 +Re-instate the creation of letterhints field in the dbfor upgrades from +before v1.97 in 2018 + ### Version 2.137 of the Moodle Gapfill question type April 2023 Fix compatibility on mobile with dark theme (css tweak) https://github.com/marcusgreen/moodle-qtype_gapfill/pull/100 diff --git a/db/upgrade.php b/db/upgrade.php index 0a95800..88c7514 100755 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -87,5 +87,13 @@ function xmldb_qtype_gapfill_upgrade($oldversion = 0) { upgrade_plugin_savepoint(true, 2020091100, 'qtype', 'gapfill'); } + if ($oldversion < 2023072899) { + if (!$dbman->field_exists('question_gapfill', 'letterhints')) { + $field = new xmldb_field('letterhints', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'optionsaftertext'); + $table = new xmldb_table('question_gapfill'); + $dbman->add_field($table, $field); + } + } + return true; } diff --git a/version.php b/version.php index 9ad1fd3..f97413f 100755 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'qtype_gapfill'; -$plugin->version = 2023042000; +$plugin->version = 2023072899; $plugin->requires = 2022040100; // Moodle 4.0. -$plugin->release = '2.137'; +$plugin->release = '2.138'; $plugin->maturity = MATURITY_STABLE;