Browse Source

Fix MariaDB compatibility

MOODLE_20_STABLE
bdaloukas 8 years ago
parent
commit
9e773e6df0
  1. 12
      db/upgrade.php
  2. 4
      version.php

12
db/upgrade.php

@ -1581,7 +1581,7 @@ function xmldb_game_upgrade($oldversion) {
$dbman->change_field_type($table, $field); $dbman->change_field_type($table, $field);
} }
if ($oldversion < ($ver = 2017062701)) { if ($oldversion < ($ver = 2017062801)) {
$table = new xmldb_table('game_cross'); $table = new xmldb_table('game_cross');
$field = new xmldb_field('usedrows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); $field = new xmldb_field('usedrows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if (!$dbman->field_exists($table, $field)) { if (!$dbman->field_exists($table, $field)) {
@ -1591,13 +1591,12 @@ function xmldb_game_upgrade($oldversion) {
$field = new xmldb_field('rows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); $field = new xmldb_field('rows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if ($dbman->field_exists($table, $field)) { if ($dbman->field_exists($table, $field)) {
mpgame_db_copy_string_to_int( 'game_cross', 'rows', 'usedrows'); mpgame_db_copy_string_to_int( 'game_cross', 'rows', 'usedrows');
$dbman->drop_field($table, $field);
} else { } else {
$dbman->add_field($table, $field); $dbman->add_field($table, $field);
} }
} }
if ($oldversion < ($ver = 2017062701)) { if ($oldversion < ($ver = 2017062801)) {
$table = new xmldb_table('game_cross'); $table = new xmldb_table('game_cross');
$field = new xmldb_field('usedcols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); $field = new xmldb_field('usedcols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if (!$dbman->field_exists($table, $field)) { if (!$dbman->field_exists($table, $field)) {
@ -1607,13 +1606,12 @@ function xmldb_game_upgrade($oldversion) {
$field = new xmldb_field('cols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); $field = new xmldb_field('cols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if ($dbman->field_exists($table, $field)) { if ($dbman->field_exists($table, $field)) {
mpgame_db_copy_string_to_int( 'game_cross', 'cols', 'usedcols'); mpgame_db_copy_string_to_int( 'game_cross', 'cols', 'usedcols');
$dbman->drop_field($table, $field);
} else { } else {
$dbman->add_field($table, $field); $dbman->add_field($table, $field);
} }
} }
if ($oldversion < ($ver = 2017062701)) { if ($oldversion < ($ver = 2017062801)) {
$table = new xmldb_table('game_snakes_database'); $table = new xmldb_table('game_snakes_database');
$field = new xmldb_field('usedrows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); $field = new xmldb_field('usedrows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if (!$dbman->field_exists($table, $field)) { if (!$dbman->field_exists($table, $field)) {
@ -1623,13 +1621,12 @@ function xmldb_game_upgrade($oldversion) {
$field = new xmldb_field('rows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); $field = new xmldb_field('rows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if ($dbman->field_exists($table, $field)) { if ($dbman->field_exists($table, $field)) {
mpgame_db_copy_string_to_int( 'game_snakes_database', 'rows', 'usedrows'); mpgame_db_copy_string_to_int( 'game_snakes_database', 'rows', 'usedrows');
$dbman->drop_field($table, $field);
} else { } else {
$dbman->add_field($table, $field); $dbman->add_field($table, $field);
} }
} }
if ($oldversion < ($ver = 2017062701)) { if ($oldversion < ($ver = 2017062801)) {
$table = new xmldb_table('game_snakes_database'); $table = new xmldb_table('game_snakes_database');
$field = new xmldb_field('usedcols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); $field = new xmldb_field('usedcols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if (!$dbman->field_exists($table, $field)) { if (!$dbman->field_exists($table, $field)) {
@ -1639,7 +1636,6 @@ function xmldb_game_upgrade($oldversion) {
$field = new xmldb_field('cols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id'); $field = new xmldb_field('cols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if ($dbman->field_exists($table, $field)) { if ($dbman->field_exists($table, $field)) {
mpgame_db_copy_string_to_int( 'game_snakes_database', 'cols', 'usedcols'); mpgame_db_copy_string_to_int( 'game_snakes_database', 'cols', 'usedcols');
$dbman->drop_field($table, $field);
} else { } else {
$dbman->add_field($table, $field); $dbman->add_field($table, $field);
} }

4
version.php

@ -35,10 +35,10 @@ if (!isset( $plugin)) {
} }
$plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics). $plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2017062702; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2017062801; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2010112400; // Requires Moodle 2.0. $plugin->requires = 2010112400; // Requires Moodle 2.0.
$plugin->cron = 0; // Period for cron to check this module (secs). $plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->release = '2017-06-27'; $plugin->release = '2017-06-28';
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
if ($useplugin != 2) { if ($useplugin != 2) {

Loading…
Cancel
Save