Browse Source

Fix MariaDB compatibility

MOODLE_20_STABLE
Vasilis Daloukas 8 years ago
parent
commit
482cc7713e
  1. 3
      CHANGES.md
  2. 10
      db/upgrade.php
  3. 2
      version.php

3
CHANGES.md

@ -1,3 +1,6 @@
Changes in version 2017-06-27 (20170627)
- Fix conversation of columns (cols,rows) from string to int
Changes in version 2017-06-20 (20170620)
- Fix conversation of columns (cols,rows) from string to int

10
db/upgrade.php

@ -52,7 +52,7 @@ defined('MOODLE_INTERNAL') || die();
function mpgame_db_copy_string_to_int( $table, $from, $to) {
global $CFG, $DB;
$sql = "SELECT id,$from,$to FROM {$CFG->prefix}$table";
$sql = "SELECT * FROM {$CFG->prefix}$table";
$recs = $DB->get_records_sql( $sql);
foreach ($recs as $rec) {
$val = intval( $rec->$from);
@ -1581,7 +1581,7 @@ function xmldb_game_upgrade($oldversion) {
$dbman->change_field_type($table, $field);
}
if ($oldversion < ($ver = 2017062002)) {
if ($oldversion < ($ver = 2017062701)) {
$table = new xmldb_table('game_cross');
$field = new xmldb_field('usedrows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if (!$dbman->field_exists($table, $field)) {
@ -1597,7 +1597,7 @@ function xmldb_game_upgrade($oldversion) {
}
}
if ($oldversion < ($ver = 2017062002)) {
if ($oldversion < ($ver = 2017062701)) {
$table = new xmldb_table('game_cross');
$field = new xmldb_field('usedcols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if (!$dbman->field_exists($table, $field)) {
@ -1613,7 +1613,7 @@ function xmldb_game_upgrade($oldversion) {
}
}
if ($oldversion < ($ver = 2017062002)) {
if ($oldversion < ($ver = 2017062701)) {
$table = new xmldb_table('game_snakes_database');
$field = new xmldb_field('usedrows', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if (!$dbman->field_exists($table, $field)) {
@ -1629,7 +1629,7 @@ function xmldb_game_upgrade($oldversion) {
}
}
if ($oldversion < ($ver = 2017062002)) {
if ($oldversion < ($ver = 2017062701)) {
$table = new xmldb_table('game_snakes_database');
$field = new xmldb_field('usedcols', XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, null, null, '0', 'id');
if (!$dbman->field_exists($table, $field)) {

2
version.php

@ -35,7 +35,7 @@ if (!isset( $plugin)) {
}
$plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2017062002; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2017062701; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2010112400; // Requires Moodle 2.0.
$plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->release = '2017-06-20';

Loading…
Cancel
Save