|
@ -1,23 +1,37 @@ |
|
|
<?php //$Id: upgrade.php,v 1.30 2011/08/27 05:37:44 bdaloukas Exp $
|
|
|
<?php |
|
|
|
|
|
// This file is part of Moodle - http://moodle.org/ |
|
|
// This file keeps track of upgrades to the game module |
|
|
|
|
|
// |
|
|
|
|
|
// Sometimes, changes between versions involve |
|
|
|
|
|
// alterations to database structures and other |
|
|
|
|
|
// major things that may break installations. |
|
|
|
|
|
// |
|
|
// |
|
|
// The upgrade function in this file will attempt |
|
|
// Moodle is free software: you can redistribute it and/or modify |
|
|
// to perform all the necessary actions to upgrade |
|
|
// it under the terms of the GNU General Public License as published by |
|
|
// your older installation to the current version. |
|
|
// the Free Software Foundation, either version 3 of the License, or |
|
|
|
|
|
// (at your option) any later version. |
|
|
// |
|
|
// |
|
|
// If there's something it cannot do itself, it |
|
|
// Moodle is distributed in the hope that it will be useful, |
|
|
// will tell you what you need to do. |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
|
|
// GNU General Public License for more details. |
|
|
// |
|
|
// |
|
|
// The commands in here will all be database-neutral, |
|
|
// You should have received a copy of the GNU General Public License |
|
|
// using the methods of database_manager class |
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|
|
// |
|
|
|
|
|
// Please do not forget to use upgrade_set_timeout() |
|
|
/* This file keeps track of upgrades to the game module |
|
|
// before any action that may take longer time to finish. |
|
|
* Sometimes, changes between versions involve |
|
|
|
|
|
* alterations to database structures and other |
|
|
|
|
|
* major things that may break installations. |
|
|
|
|
|
* |
|
|
|
|
|
* The upgrade function in this file will attempt |
|
|
|
|
|
* to perform all the necessary actions to upgrade |
|
|
|
|
|
* your older installation to the current version. |
|
|
|
|
|
* |
|
|
|
|
|
* If there's something it cannot do itself, it |
|
|
|
|
|
* will tell you what you need to do. |
|
|
|
|
|
* |
|
|
|
|
|
* The commands in here will all be database-neutral, |
|
|
|
|
|
* using the methods of database_manager class |
|
|
|
|
|
* |
|
|
|
|
|
* Please do not forget to use upgrade_set_timeout() |
|
|
|
|
|
* before any action that may take longer time to finish. |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
function xmldb_game_upgrade($oldversion) { |
|
|
function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
@ -27,7 +41,8 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007082802) { |
|
|
if ($oldversion < 2007082802) { |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
|
$field = new xmldb_field('questioncategoryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'glossarycategoryid'); |
|
|
$field = new xmldb_field('questioncategoryid', XMLDB_TYPE_INTEGER, '10', |
|
|
|
|
|
XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'glossarycategoryid'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -43,19 +58,22 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007082803) { |
|
|
if ($oldversion < 2007082803) { |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$field = new xmldb_field('glossaryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'quizid'); |
|
|
$field = new xmldb_field('glossaryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, |
|
|
|
|
|
null, null, '0', 'quizid'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$field = new xmldb_field('glossarycategoryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'glossaryid'); |
|
|
$field = new xmldb_field('glossarycategoryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, |
|
|
|
|
|
null, null, '0', 'glossaryid'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$field = new xmldb_field('questioncategoryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'glossarycategoryid'); |
|
|
$field = new xmldb_field('questioncategoryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, |
|
|
|
|
|
null, null, '0', 'glossarycategoryid'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -65,7 +83,8 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007082804) { |
|
|
if ($oldversion < 2007082804) { |
|
|
$table = new xmldb_table('game_millionaire'); |
|
|
$table = new xmldb_table('game_millionaire'); |
|
|
$field = new xmldb_field('questioncategoryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'quizid'); |
|
|
$field = new xmldb_field('questioncategoryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, |
|
|
|
|
|
null, null, '0', 'quizid'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -75,7 +94,8 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007082805) { |
|
|
if ($oldversion < 2007082805) { |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$field = new xmldb_field('try', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'answer'); |
|
|
$field = new xmldb_field('try', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, |
|
|
|
|
|
null, null, '0', 'answer'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -87,7 +107,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2007082805, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007082805, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007082807) { |
|
|
if ($oldversion < 2007082807) { |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
@ -98,24 +118,25 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$field = new xmldb_field('corrects', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'finishedword'); |
|
|
$field = new xmldb_field('corrects', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, |
|
|
|
|
|
null, null, '0', 'finishedword'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2007082807, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007082807, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007082808) { |
|
|
if ($oldversion < 2007082808) { |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
|
$field = new xmldb_field('param7', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'param6'); |
|
|
$field = new xmldb_field('param7', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, |
|
|
|
|
|
null, null, '0', 'param6'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2007082808, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007082808, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($oldversion < 2007082809) { |
|
|
if ($oldversion < 2007082809) { |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
@ -129,7 +150,8 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007082901) { |
|
|
if ($oldversion < 2007082901) { |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$field = new xmldb_field('glossaryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'quizid'); |
|
|
$field = new xmldb_field('glossaryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, |
|
|
|
|
|
null, null, '0', 'quizid'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -155,13 +177,14 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2007091001, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007091001, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007091701) { |
|
|
if ($oldversion < 2007091701) { |
|
|
$table = new xmldb_table( 'game_bookquiz_chapters'); |
|
|
$table = new xmldb_table( 'game_bookquiz_chapters'); |
|
|
|
|
|
|
|
|
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE); |
|
|
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE); |
|
|
$table->add_field('gameinstanceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0'); |
|
|
$table->add_field('gameinstanceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, |
|
|
|
|
|
XMLDB_NOTNULL, null, '0'); |
|
|
$table->add_field('chapterid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0'); |
|
|
$table->add_field('chapterid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0'); |
|
|
|
|
|
|
|
|
$table->add_key('PRIMARY', XMLDB_KEY_PRIMARY, array('id')); |
|
|
$table->add_key('PRIMARY', XMLDB_KEY_PRIMARY, array('id')); |
|
@ -171,7 +194,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$dbman->create_table($table); |
|
|
$dbman->create_table($table); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2007091701, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007091701, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007092207) { |
|
|
if ($oldversion < 2007092207) { |
|
|
$table = new xmldb_table( 'game_snakes_database'); |
|
|
$table = new xmldb_table( 'game_snakes_database'); |
|
@ -194,7 +217,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$dbman->create_table($table); |
|
|
$dbman->create_table($table); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2007092207, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007092207, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007092208) { |
|
|
if ($oldversion < 2007092208) { |
|
|
$table = new xmldb_table( 'game_snakes'); |
|
|
$table = new xmldb_table( 'game_snakes'); |
|
@ -209,7 +232,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$dbman->create_table($table); |
|
|
$dbman->create_table($table); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2007092208, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007092208, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007092301) { |
|
|
if ($oldversion < 2007092301) { |
|
|
$table = new xmldb_table('game_snakes_database'); |
|
|
$table = new xmldb_table('game_snakes_database'); |
|
@ -223,7 +246,8 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007092302) { |
|
|
if ($oldversion < 2007092302) { |
|
|
$table = new xmldb_table('game_snakes_database'); |
|
|
$table = new xmldb_table('game_snakes_database'); |
|
|
$field = new xmldb_field('height', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
$field = new xmldb_field('height', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, |
|
|
|
|
|
null, null, '0'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -305,13 +329,13 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$table = new xmldb_table('game_bookquiz_questions'); |
|
|
$table = new xmldb_table('game_bookquiz_questions'); |
|
|
$field = new xmldb_field('bookid'); |
|
|
$field = new xmldb_field('bookid'); |
|
|
|
|
|
|
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
$dbman->drop_field($table, $field); |
|
|
$dbman->drop_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2007110801, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110801, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($oldversion < 2007110802) { |
|
|
if ($oldversion < 2007110802) { |
|
|
$table = new xmldb_table( 'game_grades'); |
|
|
$table = new xmldb_table( 'game_grades'); |
|
|
|
|
|
|
|
@ -329,13 +353,13 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$dbman->create_table($table); |
|
|
$dbman->create_table($table); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2007110802, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110802, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007110811) { |
|
|
if ($oldversion < 2007110811) { |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$field = new xmldb_field('sourcemodule'); |
|
|
$field = new xmldb_field('sourcemodule'); |
|
|
|
|
|
|
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
$dbman->drop_field($table, $field); |
|
|
$dbman->drop_field($table, $field); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2007110811, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110811, 'game'); |
|
@ -345,7 +369,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$field = new xmldb_field('questionsid'); |
|
|
$field = new xmldb_field('questionsid'); |
|
|
|
|
|
|
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
$dbman->drop_field($table, $field); |
|
|
$dbman->drop_field($table, $field); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2007110812, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110812, 'game'); |
|
@ -355,7 +379,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$field = new xmldb_field('quizid'); |
|
|
$field = new xmldb_field('quizid'); |
|
|
|
|
|
|
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
$dbman->drop_field($table, $field); |
|
|
$dbman->drop_field($table, $field); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2007110813, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110813, 'game'); |
|
@ -365,7 +389,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$field = new xmldb_field('glossaryid'); |
|
|
$field = new xmldb_field('glossaryid'); |
|
|
|
|
|
|
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
$dbman->drop_field($table, $field); |
|
|
$dbman->drop_field($table, $field); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2007110814, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110814, 'game'); |
|
@ -532,7 +556,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007110834) { |
|
|
if ($oldversion < 2007110834) { |
|
|
$table = new xmldb_table( 'game_bookquiz'); |
|
|
$table = new xmldb_table( 'game_bookquiz'); |
|
|
$field = new xmldb_field( 'attemptid', XMLDB_TYPE_FLOAT, null, null, null, null, '0'); |
|
|
$field = new xmldb_field( 'attemptid', XMLDB_TYPE_FLOAT, null, null, null, null, '0'); |
|
|
|
|
|
|
|
|
$dbman->rename_field($table, $field, 'score'); |
|
|
$dbman->rename_field($table, $field, 'score'); |
|
|
|
|
|
|
|
@ -551,7 +575,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007110836) { |
|
|
if ($oldversion < 2007110836) { |
|
|
$table = new xmldb_table( 'game_cross'); |
|
|
$table = new xmldb_table( 'game_cross'); |
|
|
$field = new xmldb_field( 'timelimit', XMLDB_TYPE_FLOAT, null, null, null, null, '0'); |
|
|
$field = new xmldb_field( 'timelimit', XMLDB_TYPE_FLOAT, null, null, null, null, '0'); |
|
|
|
|
|
|
|
|
$dbman->rename_field($table, $field, 'createtimelimit'); |
|
|
$dbman->rename_field($table, $field, 'createtimelimit'); |
|
|
upgrade_mod_savepoint(true, 2007110836, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110836, 'game'); |
|
@ -580,7 +604,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
if ($oldversion < 2007110839) { |
|
|
if ($oldversion < 2007110839) { |
|
|
$table = new xmldb_table('game_cross'); |
|
|
$table = new xmldb_table('game_cross'); |
|
|
$field = new xmldb_field('createspaces', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
$field = new xmldb_field('createspaces', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -594,7 +618,6 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$dbman->drop_table($table); |
|
|
$dbman->drop_table($table); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2007110840, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110840, 'game'); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007110841) { |
|
|
if ($oldversion < 2007110841) { |
|
@ -663,7 +686,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007110859) { |
|
|
if ($oldversion < 2007110859) { |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$field = new xmldb_field( 'timestarted', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
$field = new xmldb_field( 'timestarted', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
|
|
|
|
|
|
$dbman->rename_field($table, $field, 'timestart'); |
|
|
$dbman->rename_field($table, $field, 'timestart'); |
|
|
upgrade_mod_savepoint(true, 2007110859, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110859, 'game'); |
|
@ -671,7 +694,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007110860) { |
|
|
if ($oldversion < 2007110860) { |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$field = new xmldb_field( 'timefinished', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
$field = new xmldb_field( 'timefinished', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
|
|
|
|
|
|
$dbman->rename_field( $table, $field, 'timefinish'); |
|
|
$dbman->rename_field( $table, $field, 'timefinish'); |
|
|
upgrade_mod_savepoint(true, 2007110860, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110860, 'game'); |
|
@ -689,7 +712,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007110862) { |
|
|
if ($oldversion < 2007110862) { |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$field = new xmldb_field( 'tries', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
$field = new xmldb_field( 'tries', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
|
|
|
|
|
|
$dbman->rename_field( $table, $field, 'attempts'); |
|
|
$dbman->rename_field( $table, $field, 'attempts'); |
|
|
upgrade_mod_savepoint(true, 2007110862, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110862, 'game'); |
|
@ -697,8 +720,8 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007110863) { |
|
|
if ($oldversion < 2007110863) { |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$field = new xmldb_field( 'preview', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, null, null, '0', 'lastremotehost'); |
|
|
$field = new xmldb_field( 'preview', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, null, null, '0', 'lastremotehost'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -707,7 +730,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007110864) { |
|
|
if ($oldversion < 2007110864) { |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$field = new xmldb_field( 'attempt', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'preview'); |
|
|
$field = new xmldb_field( 'attempt', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'preview'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -717,7 +740,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007110865) { |
|
|
if ($oldversion < 2007110865) { |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$table = new xmldb_table( 'game_attempts'); |
|
|
$field = new xmldb_field( 'score', XMLDB_TYPE_FLOAT, null, XMLDB_UNSIGNED, null, null, '0', 'attempt'); |
|
|
$field = new xmldb_field( 'score', XMLDB_TYPE_FLOAT, null, XMLDB_UNSIGNED, null, null, '0', 'attempt'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -725,7 +748,6 @@ function xmldb_game_upgrade($oldversion) { |
|
|
upgrade_mod_savepoint(true, 2007110865, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110865, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($oldversion < 2007110866) { |
|
|
if ($oldversion < 2007110866) { |
|
|
$table = new xmldb_table( 'game_course_input'); |
|
|
$table = new xmldb_table( 'game_course_input'); |
|
|
|
|
|
|
|
@ -741,7 +763,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$dbman->create_table($table); |
|
|
$dbman->create_table($table); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2007110866, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007110866, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111302) { |
|
|
if ($oldversion < 2007111302) { |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
@ -824,14 +846,14 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111310) { |
|
|
if ($oldversion < 2007111310) { |
|
|
$DB->execute('UPDATE {game} SET grade=0 WHERE grade IS NULL', true); |
|
|
$DB->execute('UPDATE {game} SET grade=0 WHERE grade IS NULL', true); |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2007111310, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007111310, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111842) { |
|
|
if ($oldversion < 2007111842) { |
|
|
$table = new xmldb_table( 'game_queries'); |
|
|
$table = new xmldb_table( 'game_queries'); |
|
|
$field = new xmldb_field( 'gameinstanceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
$field = new xmldb_field( 'gameinstanceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
|
|
|
|
|
|
$dbman->rename_field( $table, $field, 'attemptid'); |
|
|
$dbman->rename_field( $table, $field, 'attemptid'); |
|
|
|
|
|
|
|
@ -860,7 +882,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111844) { |
|
|
if ($oldversion < 2007111844) { |
|
|
$table = new xmldb_table('game_queries'); |
|
|
$table = new xmldb_table('game_queries'); |
|
|
$field = new xmldb_field('questiontext', XMLDB_TYPE_TEXT, null, null, null, null, '','glossaryentryid'); |
|
|
$field = new xmldb_field('questiontext', XMLDB_TYPE_TEXT, null, null, null, null, '', 'glossaryentryid'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -870,7 +892,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111845) { |
|
|
if ($oldversion < 2007111845) { |
|
|
$table = new xmldb_table('game_queries'); |
|
|
$table = new xmldb_table('game_queries'); |
|
|
$field = new xmldb_field('score', XMLDB_TYPE_FLOAT, null, null, null, null, '0','questiontext'); |
|
|
$field = new xmldb_field('score', XMLDB_TYPE_FLOAT, null, null, null, null, '0', 'questiontext'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -880,7 +902,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111846) { |
|
|
if ($oldversion < 2007111846) { |
|
|
$table = new xmldb_table('game_queries'); |
|
|
$table = new xmldb_table('game_queries'); |
|
|
$field = new xmldb_field('studentanswer', XMLDB_TYPE_TEXT, null, null, null, null, '','glossaryentryid'); |
|
|
$field = new xmldb_field('studentanswer', XMLDB_TYPE_TEXT, null, null, null, null, '', 'glossaryentryid'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -890,7 +912,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111847) { |
|
|
if ($oldversion < 2007111847) { |
|
|
$table = new xmldb_table( 'game_queries'); |
|
|
$table = new xmldb_table( 'game_queries'); |
|
|
$field = new xmldb_field( 'col', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, '0'); |
|
|
$field = new xmldb_field( 'col', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, '0'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -900,7 +922,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111848) { |
|
|
if ($oldversion < 2007111848) { |
|
|
$table = new xmldb_table( 'game_queries'); |
|
|
$table = new xmldb_table( 'game_queries'); |
|
|
$field = new xmldb_field( 'row', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
$field = new xmldb_field( 'row', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -910,7 +932,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111849) { |
|
|
if ($oldversion < 2007111849) { |
|
|
$table = new xmldb_table( 'game_queries'); |
|
|
$table = new xmldb_table( 'game_queries'); |
|
|
$field = new xmldb_field( 'horizontal', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, null, null, '0'); |
|
|
$field = new xmldb_field( 'horizontal', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, null, null, '0'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -930,7 +952,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111851) { |
|
|
if ($oldversion < 2007111851) { |
|
|
$table = new xmldb_table( 'game_queries'); |
|
|
$table = new xmldb_table( 'game_queries'); |
|
|
$field = new xmldb_field( 'correct', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
$field = new xmldb_field( 'correct', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
@ -939,10 +961,10 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111853) { |
|
|
if ($oldversion < 2007111853) { |
|
|
execute_sql('UPDATE {game} SET grademethod=1 WHERE grademethod=0 OR grademethod IS NULL', true); |
|
|
execute_sql('UPDATE {game} SET grademethod=1 WHERE grademethod=0 OR grademethod IS NULL', true); |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2007111853, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007111853, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111854) { |
|
|
if ($oldversion < 2007111854) { |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
@ -957,7 +979,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
if ($oldversion < 2007111855) { |
|
|
if ($oldversion < 2007111855) { |
|
|
$table = new xmldb_table('game_snakes'); |
|
|
$table = new xmldb_table('game_snakes'); |
|
|
$field = new xmldb_field('queryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'snakesdatabaseid'); |
|
|
$field = new xmldb_field('queryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'snakesdatabaseid'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -966,8 +988,8 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2007111856) { |
|
|
if ($oldversion < 2007111856) { |
|
|
$table = new xmldb_table( 'game_bookquiz_chapters'); |
|
|
$table = new xmldb_table( 'game_bookquiz_chapters'); |
|
|
$field = new xmldb_field( 'attemptid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'id'); |
|
|
$field = new xmldb_field( 'attemptid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'id'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1000,12 +1022,12 @@ function xmldb_game_upgrade($oldversion) { |
|
|
upgrade_mod_savepoint(true, 2007120106, 'game'); |
|
|
upgrade_mod_savepoint(true, 2007120106, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//2008 |
|
|
// Here starts year 2008. |
|
|
|
|
|
|
|
|
if ($oldversion < 2008011301) { |
|
|
if ($oldversion < 2008011301) { |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
|
$field = new xmldb_field('glossaryid2', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
$field = new xmldb_field('glossaryid2', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1015,7 +1037,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
if ($oldversion < 2008011302) { |
|
|
if ($oldversion < 2008011302) { |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
|
$field = new xmldb_field('glossarycategoryid2', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
$field = new xmldb_field('glossarycategoryid2', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1025,7 +1047,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
if ($oldversion < 2008011308) { |
|
|
if ($oldversion < 2008011308) { |
|
|
$table = new xmldb_table('game_queries'); |
|
|
$table = new xmldb_table('game_queries'); |
|
|
$field = new xmldb_field('attachment', XMLDB_TYPE_CHAR, '200', null, null, null, ''); |
|
|
$field = new xmldb_field('attachment', XMLDB_TYPE_CHAR, '200', null, null, null, ''); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1046,7 +1068,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$dbman->create_table($table); |
|
|
$dbman->create_table($table); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2008011504, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008011504, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008012701) { |
|
|
if ($oldversion < 2008012701) { |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
@ -1056,7 +1078,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2008012701, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008012701, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008071101) { |
|
|
if ($oldversion < 2008071101) { |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
@ -1088,13 +1110,13 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$dbman->create_table($table); |
|
|
$dbman->create_table($table); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2008072204, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008072204, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008072501) { |
|
|
if ($oldversion < 2008072501) { |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$table = new xmldb_table('game_hangman'); |
|
|
$field = new xmldb_field('quizid'); |
|
|
$field = new xmldb_field('quizid'); |
|
|
|
|
|
|
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
if ($dbman->field_exists($table, $field)) { |
|
|
$dbman->drop_field($table, $field); |
|
|
$dbman->drop_field($table, $field); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2008072501, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008072501, 'game'); |
|
@ -1138,7 +1160,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2008090101, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008090101, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008101103) { |
|
|
if ($oldversion < 2008101103) { |
|
|
$table = new xmldb_table('game_millionaire'); |
|
|
$table = new xmldb_table('game_millionaire'); |
|
@ -1146,7 +1168,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
$dbman->change_field_precision($table, $field); |
|
|
$dbman->change_field_precision($table, $field); |
|
|
upgrade_mod_savepoint(true, 2008101103, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008101103, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008101104) { |
|
|
if ($oldversion < 2008101104) { |
|
|
$table = new xmldb_table('game_millionaire'); |
|
|
$table = new xmldb_table('game_millionaire'); |
|
@ -1154,7 +1176,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
$dbman->change_field_precision($table, $field); |
|
|
$dbman->change_field_precision($table, $field); |
|
|
upgrade_mod_savepoint(true, 2008101104, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008101104, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008101106) { |
|
|
if ($oldversion < 2008101106) { |
|
|
$table = new xmldb_table('game_sudoku'); |
|
|
$table = new xmldb_table('game_sudoku'); |
|
@ -1162,7 +1184,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
$dbman->cchange_field_precision($table, $field); |
|
|
$dbman->cchange_field_precision($table, $field); |
|
|
upgrade_mod_savepoint(true, 2008101106, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008101106, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008101107) { |
|
|
if ($oldversion < 2008101107) { |
|
|
$table = new xmldb_table('game_hiddenpicture'); |
|
|
$table = new xmldb_table('game_hiddenpicture'); |
|
@ -1170,7 +1192,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
$dbman->change_field_precision($table, $field); |
|
|
$dbman->change_field_precision($table, $field); |
|
|
upgrade_mod_savepoint(true, 2008101107, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008101107, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008101108) { |
|
|
if ($oldversion < 2008101108) { |
|
|
$table = new xmldb_table('game_hiddenpicture'); |
|
|
$table = new xmldb_table('game_hiddenpicture'); |
|
@ -1178,7 +1200,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
$dbman->change_field_precision($table, $field); |
|
|
$dbman->change_field_precision($table, $field); |
|
|
upgrade_mod_savepoint(true, 2008101108, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008101108, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008101109) { |
|
|
if ($oldversion < 2008101109) { |
|
|
$table = new xmldb_table('game_hiddenpicture'); |
|
|
$table = new xmldb_table('game_hiddenpicture'); |
|
@ -1186,7 +1208,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
$dbman->change_field_precision($table, $field); |
|
|
$dbman->change_field_precision($table, $field); |
|
|
upgrade_mod_savepoint(true, 2008101109, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008101109, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008102701) { |
|
|
if ($oldversion < 2008102701) { |
|
|
$table = new xmldb_table('game_queries'); |
|
|
$table = new xmldb_table('game_queries'); |
|
@ -1196,7 +1218,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2008102701, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008102701, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008110701) { |
|
|
if ($oldversion < 2008110701) { |
|
|
$table = new xmldb_table( 'game_export_html'); |
|
|
$table = new xmldb_table( 'game_export_html'); |
|
@ -1215,11 +1237,11 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$dbman->create_table($table); |
|
|
$dbman->create_table($table); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2008110701, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008110701, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2008111701) { |
|
|
if ($oldversion < 2008111701) { |
|
|
$table = new xmldb_table( 'game_snakes_database'); |
|
|
$table = new xmldb_table( 'game_snakes_database'); |
|
|
$field = new xmldb_field( 'file', XMLDB_TYPE_CHAR, 100, null, null, null, ''); |
|
|
$field = new xmldb_field( 'file', XMLDB_TYPE_CHAR, 100, null, null, null, ''); |
|
|
|
|
|
|
|
|
$dbman->rename_field( $table, $field, 'fileboard'); |
|
|
$dbman->rename_field( $table, $field, 'fileboard'); |
|
|
upgrade_mod_savepoint(true, 2008111701, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008111701, 'game'); |
|
@ -1235,7 +1257,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
upgrade_mod_savepoint(true, 2008111801, 'game'); |
|
|
upgrade_mod_savepoint(true, 2008111801, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//2009 |
|
|
// Year 2009 starts here. |
|
|
|
|
|
|
|
|
if ($oldversion < 2009010502) { |
|
|
if ($oldversion < 2009010502) { |
|
|
$table = new xmldb_table('game_export_javame'); |
|
|
$table = new xmldb_table('game_export_javame'); |
|
@ -1245,7 +1267,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2009010502, 'game'); |
|
|
upgrade_mod_savepoint(true, 2009010502, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2009031801) { |
|
|
if ($oldversion < 2009031801) { |
|
|
$table = new xmldb_table('game_repetitions'); |
|
|
$table = new xmldb_table('game_repetitions'); |
|
@ -1264,7 +1286,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
$dbman->create_table($table); |
|
|
$dbman->create_table($table); |
|
|
} |
|
|
} |
|
|
upgrade_mod_savepoint(true, 2009031801, 'game'); |
|
|
upgrade_mod_savepoint(true, 2009031801, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2009071403) { |
|
|
if ($oldversion < 2009071403) { |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
@ -1274,7 +1296,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2009071403, 'game'); |
|
|
upgrade_mod_savepoint(true, 2009071403, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2009072801) { |
|
|
if ($oldversion < 2009072801) { |
|
|
$table = new xmldb_table('game_export_html'); |
|
|
$table = new xmldb_table('game_export_html'); |
|
@ -1284,7 +1306,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2009072801, 'game'); |
|
|
upgrade_mod_savepoint(true, 2009072801, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2009072901) { |
|
|
if ($oldversion < 2009072901) { |
|
|
$table = new xmldb_table('game_export_html'); |
|
|
$table = new xmldb_table('game_export_html'); |
|
@ -1294,7 +1316,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2009072901, 'game'); |
|
|
upgrade_mod_savepoint(true, 2009072901, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2009073101) { |
|
|
if ($oldversion < 2009073101) { |
|
|
$table = new xmldb_table('game_export_html'); |
|
|
$table = new xmldb_table('game_export_html'); |
|
@ -1304,7 +1326,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2009073101, 'game'); |
|
|
upgrade_mod_savepoint(true, 2009073101, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2009073102) { |
|
|
if ($oldversion < 2009073102) { |
|
|
$table = new xmldb_table('game_export_javame'); |
|
|
$table = new xmldb_table('game_export_javame'); |
|
@ -1314,7 +1336,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2009073102, 'game'); |
|
|
upgrade_mod_savepoint(true, 2009073102, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2009083102) { |
|
|
if ($oldversion < 2009083102) { |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
@ -1347,7 +1369,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2010071607) { |
|
|
if ($oldversion < 2010071607) { |
|
|
$table = new xmldb_table( 'game_export_html'); |
|
|
$table = new xmldb_table( 'game_export_html'); |
|
|
$field = new xmldb_field( 'gameid', XMLDB_TYPE_INTEGER, 10, null, null, null, null, null, '0'); |
|
|
$field = new xmldb_field( 'gameid', XMLDB_TYPE_INTEGER, 10, null, null, null, null, null, '0'); |
|
|
|
|
|
|
|
|
$dbman->rename_field($table, $field, 'id'); |
|
|
$dbman->rename_field($table, $field, 'id'); |
|
|
|
|
|
|
|
@ -1367,7 +1389,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2010071610) { |
|
|
if ($oldversion < 2010071610) { |
|
|
$table = new xmldb_table( 'game_export_javame'); |
|
|
$table = new xmldb_table( 'game_export_javame'); |
|
|
$field = new xmldb_field( 'gameid', XMLDB_TYPE_INTEGER, 10, null, null, null, null, null, '0'); |
|
|
$field = new xmldb_field( 'gameid', XMLDB_TYPE_INTEGER, 10, null, null, null, null, null, '0'); |
|
|
|
|
|
|
|
|
$dbman->rename_field($table, $field, 'id'); |
|
|
$dbman->rename_field($table, $field, 'id'); |
|
|
|
|
|
|
|
@ -1376,31 +1398,31 @@ function xmldb_game_upgrade($oldversion) { |
|
|
|
|
|
|
|
|
if ($oldversion < 2010072605) { |
|
|
if ($oldversion < 2010072605) { |
|
|
|
|
|
|
|
|
// Define field language to be added to game_attempts |
|
|
// Define field language to be added to game_attempts. |
|
|
$table = new xmldb_table('game_attempts'); |
|
|
$table = new xmldb_table('game_attempts'); |
|
|
$field = new xmldb_field('language', XMLDB_TYPE_CHAR, '10', null, null, null, null, 'attempts'); |
|
|
$field = new xmldb_field('language', XMLDB_TYPE_CHAR, '10', null, null, null, null, 'attempts'); |
|
|
|
|
|
|
|
|
// Conditionally launch add field language |
|
|
// Conditionally launch add field language. |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// game savepoint reached |
|
|
// Game savepoint reached. |
|
|
upgrade_mod_savepoint(true, 2010072605, 'game'); |
|
|
upgrade_mod_savepoint(true, 2010072605, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2010090301) { |
|
|
if ($oldversion < 2010090301) { |
|
|
|
|
|
|
|
|
// Define field param9 to be added to game |
|
|
// Define field param9 to be added to game. |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
|
$field = new xmldb_field('param9', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'param8'); |
|
|
$field = new xmldb_field('param9', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'param8'); |
|
|
|
|
|
|
|
|
// Conditionally launch add field param9 |
|
|
// Conditionally launch add field param9. |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// game savepoint reached |
|
|
// Game savepoint reached. |
|
|
upgrade_mod_savepoint(true, 2010090301, 'game'); |
|
|
upgrade_mod_savepoint(true, 2010090301, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1421,7 +1443,7 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2011072704, 'game'); |
|
|
upgrade_mod_savepoint(true, 2011072704, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2011072705) { |
|
|
if ($oldversion < 2011072705) { |
|
|
$table = new xmldb_table('game_export_html'); |
|
|
$table = new xmldb_table('game_export_html'); |
|
@ -1431,70 +1453,69 @@ function xmldb_game_upgrade($oldversion) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade_mod_savepoint(true, 2011072705, 'game'); |
|
|
upgrade_mod_savepoint(true, 2011072705, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2011072902) { |
|
|
if ($oldversion < 2011072902) { |
|
|
|
|
|
|
|
|
// Define field param10 to be added to game |
|
|
// Define field param10 to be added to game. |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
|
$field = new xmldb_field('param10', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'param9'); |
|
|
$field = new xmldb_field('param10', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'param9'); |
|
|
|
|
|
|
|
|
// Conditionally launch add field param10 |
|
|
// Conditionally launch add field param10. |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// game savepoint reached |
|
|
// Game savepoint reached. |
|
|
upgrade_mod_savepoint(true, 2011072902, 'game'); |
|
|
upgrade_mod_savepoint(true, 2011072902, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2011082603) { |
|
|
if ($oldversion < 2011082603) { |
|
|
|
|
|
|
|
|
// Define field timeopen to be added to game |
|
|
// Define field timeopen to be added to game. |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
|
$field = new xmldb_field('timeopen', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'sourcemodule'); |
|
|
$field = new xmldb_field('timeopen', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'sourcemodule'); |
|
|
|
|
|
|
|
|
// Conditionally launch add field timeopen |
|
|
// Conditionally launch add field timeopen. |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// game savepoint reached |
|
|
// Game savepoint reached. |
|
|
upgrade_mod_savepoint(true, 2011082603, 'game'); |
|
|
upgrade_mod_savepoint(true, 2011082603, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2011082604) { |
|
|
if ($oldversion < 2011082604) { |
|
|
|
|
|
|
|
|
// Define field timeclose to be added to game |
|
|
// Define field timeclose to be added to game. |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
|
$field = new xmldb_field('timeclose', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'timeopen'); |
|
|
$field = new xmldb_field('timeclose', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'timeopen'); |
|
|
|
|
|
|
|
|
// Conditionally launch add field timeclose |
|
|
// Conditionally launch add field timeclose. |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// game savepoint reached |
|
|
// Game savepoint reached. |
|
|
upgrade_mod_savepoint(true, 2011082604, 'game'); |
|
|
upgrade_mod_savepoint(true, 2011082604, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($oldversion < 2013072601) { |
|
|
if ($oldversion < 2013072601) { |
|
|
|
|
|
|
|
|
// Define field timeclose to be added to game |
|
|
// Define field timeclose to be added to game. |
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
|
$field = new xmldb_field('maxattempts', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'subcategories'); |
|
|
$field = new xmldb_field('maxattempts', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'subcategories'); |
|
|
|
|
|
|
|
|
// Conditionally launch add field maxattempts |
|
|
// Conditionally launch add field maxattempts. |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
$dbman->add_field($table, $field); |
|
|
$dbman->add_field($table, $field); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// game savepoint reached |
|
|
// Game savepoint reached. |
|
|
upgrade_mod_savepoint(true, 2013072601, 'game'); |
|
|
upgrade_mod_savepoint(true, 2013072601, 'game'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $oldversion < 2015122105) |
|
|
if ($oldversion < 2015122105) { |
|
|
{ |
|
|
|
|
|
$table = new xmldb_table('game'); |
|
|
$table = new xmldb_table('game'); |
|
|
$field = new xmldb_field('userlanguage', XMLDB_TYPE_CHAR, '100'); |
|
|
$field = new xmldb_field('userlanguage', XMLDB_TYPE_CHAR, '100'); |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|
if (!$dbman->field_exists($table, $field)) { |
|
|