From 0d3b042fecaac2e07a4eb63cde95436efa7014a5 Mon Sep 17 00:00:00 2001 From: gbateson Date: Wed, 13 Sep 2006 21:25:58 +0000 Subject: [PATCH] fix bug 6538, in which $db->MetaColumns was not defined in some PG sites --- mod/hotpot/db/postgres7.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/mod/hotpot/db/postgres7.php b/mod/hotpot/db/postgres7.php index 9a8f79d5159..80210e4af3a 100644 --- a/mod/hotpot/db/postgres7.php +++ b/mod/hotpot/db/postgres7.php @@ -3,23 +3,18 @@ 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) { - $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; - } + require_once $update_to_v2; + if (hotpot_db_field_exists('hotpot_attempts', 'details')) { + $oldversion = 2005031400; } } - // 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;