From 22c633e8b7c4b623e73b2e37e6a23780069e01c5 Mon Sep 17 00:00:00 2001 From: gbateson Date: Wed, 13 Sep 2006 08:26:16 +0000 Subject: [PATCH] when updating, if the version number indicates this could be an early HotPot v2.1 (Moodle 1.6) then check this is not HotPot v2.0 (Moodle 1.5) with an overly advanced version number. Also, added backwards compatability back to Moodle 1.1.1 New release is HotPot v2.1.23, version is 2006082900 --- mod/hotpot/README.TXT | 2 +- mod/hotpot/db/mysql.php | 19 ++++++++++++++++++- mod/hotpot/db/postgres7.php | 14 ++++++++++++++ mod/hotpot/version.php | 6 +++--- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/mod/hotpot/README.TXT b/mod/hotpot/README.TXT index 0bb3cb54717..d8d6e24f221 100644 --- a/mod/hotpot/README.TXT +++ b/mod/hotpot/README.TXT @@ -1,5 +1,5 @@ =============================================== -This is v2.1.22 of the HotPot module for Moodle +This is v2.1.23 of the HotPot module for Moodle =============================================== This module allows teachers to administer Hot Potatoes and TexToys quizzes via Moodle. diff --git a/mod/hotpot/db/mysql.php b/mod/hotpot/db/mysql.php index 561f6260c5f..394b92acc5a 100644 --- a/mod/hotpot/db/mysql.php +++ b/mod/hotpot/db/mysql.php @@ -1,8 +1,25 @@ 2005031400 && $oldversion<=2006082899) { + $columns = $db->MetaColumns($CFG->prefix.'hotpot_attempts'); + foreach ($columns as $column) { + if ($column->name=='details') { + // the "hotpot_attempts" table has a "details" field so this is actually HotPot v2.0 + // reset the version number in order to trigger the correct order of updates + print "HotPot v2.0 detected
"; + $oldversion = 2005031400; + break; + } + } + } + if ($oldversion < 2004021400) { execute_sql(" ALTER TABLE `{$CFG->prefix}hotpot_events` ADD `starttime` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `time`"); execute_sql(" ALTER TABLE `{$CFG->prefix}hotpot_events` ADD `endtime` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `time`"); diff --git a/mod/hotpot/db/postgres7.php b/mod/hotpot/db/postgres7.php index e5f80e4f94d..9a8f79d5159 100644 --- a/mod/hotpot/db/postgres7.php +++ b/mod/hotpot/db/postgres7.php @@ -3,6 +3,20 @@ function hotpot_upgrade($oldversion) { global $CFG; $ok = true; + // if the version number indicates this could be an early HotPot v2.1 (Moodle 1.6), + // check this is not actually HotPot v2.0 (Moodle 1.5) with an overly advanced version number + if ($oldversion>2005031400 && $oldversion<=2006082899) { + $columns = $db->MetaColumns($CFG->prefix.'hotpot_attempts'); + foreach ($columns as $column) { + if ($column->name=='details') { + // the "hotpot_attempts" table has a "details" field so this is actually HotPot v2.0 + // reset the version number in order to trigger the correct order of updates + $oldversion = 2005031400; + break; + } + } + } + // set path to update functions $update_to_v2 = "$CFG->dirroot/mod/hotpot/db/update_to_v2.php"; diff --git a/mod/hotpot/version.php b/mod/hotpot/version.php index cad8ae3e218..5603360f29d 100644 --- a/mod/hotpot/version.php +++ b/mod/hotpot/version.php @@ -3,9 +3,9 @@ /// Code fragment to define the version of hotpot /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080701; // change only last two digits in 1.6.x!! -$module->release = 'v2.1.22'; // human-friendly version name (used in mod/hotpot/lib.php) -$module->requires = 2006050512; // replace with 2005060241 if you want to use it with latest 1.5.4+ +$module->version = 2006082900; // change only last two digits in 1.6.x!! +$module->release = 'v2.1.23'; // human-friendly version name (used in mod/hotpot/lib.php) +$module->requires = 2003091111; // replace with 2005060241 if you want to use it with latest 1.5.4+ $module->cron = 0; // period for cron to check this module (secs) // interpretation of YYYYMMDDXY version numbers // YYYY : year