Skip to content

Commit

Permalink
fix for overly advanced version numbers in HotPot module in Moodle 1.…
Browse files Browse the repository at this point in the history
…5 (see bug MDL-6538)
  • Loading branch information
gbateson committed Sep 13, 2006
1 parent 18a6481 commit e9be584
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
15 changes: 12 additions & 3 deletions mod/hotpot/db/mysql.php
Expand Up @@ -3,14 +3,23 @@ function hotpot_upgrade($oldversion) {
global $CFG;
$ok = true;

// set path to update functions
$update_to_v2 = "$CFG->dirroot/mod/hotpot/db/update_to_v2.php";

// 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) {
require_once $update_to_v2;
if (hotpot_db_field_exists('hotpot_attempts', 'details')) {
$oldversion = 2005031400;
}
}

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`");
}

// set path to update functions
$update_to_v2 = "$CFG->dirroot/mod/hotpot/db/update_to_v2.php";

// update from HotPot v1 to HotPot v2
if ($oldversion < 2005031400) {
require_once $update_to_v2;
Expand Down
9 changes: 9 additions & 0 deletions mod/hotpot/db/postgres7.php
Expand Up @@ -6,6 +6,15 @@ function hotpot_upgrade($oldversion) {
// set path to update functions
$update_to_v2 = "$CFG->dirroot/mod/hotpot/db/update_to_v2.php";

// 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) {
require_once $update_to_v2;
if (hotpot_db_field_exists('hotpot_attempts', 'details')) {
$oldversion = 2005031400;
}
}

// update from HotPot v1 to HotPot v2
if ($oldversion < 2005031400) {
require_once $update_to_v2;
Expand Down

0 comments on commit e9be584

Please sign in to comment.