Browse files

fix bug 5304

  • Loading branch information...
1 parent bb3af8d commit da6bacb7e259963304033c0f8f38694bc382d45c gbateson committed Apr 24, 2006
Showing with 18 additions and 5 deletions.
  1. +1 −1 mod/hotpot/db/mysql.php
  2. +1 −1 mod/hotpot/db/postgres7.php
  3. +15 −2 mod/hotpot/db/update_to_v2.php
  4. +1 −1 mod/hotpot/version.php
View
2 mod/hotpot/db/mysql.php
@@ -22,7 +22,7 @@ function hotpot_upgrade($oldversion) {
$ok = $ok && hotpot_update_to_v2_1_2();
}
// update to HotPot v2.1.16
- if ($oldversion < 2006042102) {
+ if ($oldversion < 2006042103) {
$ok = $ok && hotpot_get_update_to_v2();
$ok = $ok && hotpot_update_to_v2_1_16();
}
View
2 mod/hotpot/db/postgres7.php
@@ -28,7 +28,7 @@ function hotpot_upgrade($oldversion) {
$ok = $ok && hotpot_update_to_v2_1_8();
}
// update to HotPot v2.1.16
- if ($oldversion < 2006042102) {
+ if ($oldversion < 2006042103) {
$ok = $ok && hotpot_get_update_to_v2();
$ok = $ok && hotpot_update_to_v2_1_16();
}
View
17 mod/hotpot/db/update_to_v2.php
@@ -3,8 +3,21 @@ function hotpot_update_to_v2_1_16() {
global $CFG;
$ok = true;
+ // settings for the "hotpot_questions_name_idx" index
+ $length = 20;
+ $field = 'name';
+ $table = 'hotpot_questions';
+ $index = '{$table}_{$name}_idx';
+
+ // remove the index
+ hotpot_db_delete_index("{$CFG->prefix}$table", $index);
+ hotpot_db_delete_index("{$CFG->prefix}$table", "{$CFG->prefix}$index");
+
// make sure type of 'name' is a text field (not varchar 255)
- $ok = $ok && hotpot_db_update_field_type('hotpot_questions', 'name', 'name', 'TEXT', '', '', 'NOT NULL', '');
+ $ok = $ok && hotpot_db_update_field_type($table, $field, $field, 'TEXT', '', '', 'NOT NULL', '');
+
+ // restore the index
+ $ok = $ok && hotpot_db_add_index($table, $field, $length);
if (strtolower($CFG->dbtype)=='mysql') {
@@ -26,7 +39,7 @@ function hotpot_update_to_v2_1_16() {
$ok = $ok && hotpot_index_remove_prefix('hotpot_attempts', 'userid');
$ok = $ok && hotpot_index_remove_prefix('hotpot_details', 'attempt');
$ok = $ok && hotpot_index_remove_prefix('hotpot_questions', 'hotpot');
- $ok = $ok && hotpot_index_remove_prefix('hotpot_questions', 'name', 20);
+ //$ok = $ok && hotpot_index_remove_prefix('hotpot_questions', 'name', 20);
$ok = $ok && hotpot_index_remove_prefix('hotpot_responses', 'attempt');
$ok = $ok && hotpot_index_remove_prefix('hotpot_responses', 'question');
$ok = $ok && hotpot_index_remove_prefix('hotpot_strings', 'string', 20);
View
2 mod/hotpot/version.php
@@ -3,7 +3,7 @@
/// Code fragment to define the version of hotpot
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006042102; // release date of this version (see note below)
+$module->version = 2006042103; // release date of this version (see note below)
$module->release = 'v2.1.16'; // human-friendly version name (used in mod/hotpot/lib.php)
$module->cron = 0; // period for cron to check this module (secs)
// interpretation of YYYYMMDDXY version numbers

0 comments on commit da6bacb

Please sign in to comment.