From dfd535fac907e0b8acd63012ae5c3a316d0a183f Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 31 Aug 2007 23:44:37 +0000 Subject: [PATCH] Now, under MySQL, a check of wrongly signed ints is also performed. MDL-11038 --- .../check_bigints/check_bigints.class.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/admin/xmldb/actions/check_bigints/check_bigints.class.php b/admin/xmldb/actions/check_bigints/check_bigints.class.php index c908fabf46..676282c81c 100644 --- a/admin/xmldb/actions/check_bigints/check_bigints.class.php +++ b/admin/xmldb/actions/check_bigints/check_bigints.class.php @@ -26,7 +26,8 @@ /// This class will check all the int(10) fields existing in the DB /// reporting about the ones not phisically implemented as BIGINTs -/// and providing one SQL script to fix all them. MDL-11038 +/// and providing one SQL script to fix all them. Also, under MySQL, +/// it performs one check of signed bigints. MDL-11038 class check_bigints extends XMLDBAction { @@ -52,6 +53,7 @@ class check_bigints extends XMLDBAction { 'completelogbelow' => 'xmldb', 'nowrongintsfound' => 'xmldb', 'yeswrongintsfound' => 'xmldb', + 'mysqlextracheckbigints' => 'xmldb', 'yes' => '', 'no' => '', 'error' => '', @@ -104,6 +106,9 @@ class check_bigints extends XMLDBAction { $o = ''; $o.= '
'; $o.= '

' . $this->str['confirmcheckbigints'] . '

'; + if ($CFG->dbfamily == 'mysql') { + $o.= '

' . $this->str['mysqlextracheckbigints'] . '

'; + } $o.= '
'; $o.= '
'; $o.= '
'; @@ -187,17 +192,16 @@ class check_bigints extends XMLDBAction { $metacolumn = $metacolumns[$xmldb_field->getName()]; /// Going to check this field in DB $o.='
  • ' . $this->str['field'] . ': ' . $xmldb_field->getName() . ' '; - /// Detect if the phisical field is wrong - if ($metacolumn->type == $correct_type) { - $o.='' . $this->str['ok'] . '
  • '; - continue; - } else { + /// Detect if the phisical field is wrong and, under mysql, check for incorrect signed fields too + if ($metacolumn->type != $correct_type || ($CFG->dbfamily == 'mysql' && $xmldb_field->getUnsigned() && !$metacolumn->unsigned)) { $o.='' . $this->str['wrong'] . ''; /// Add the wrong field to the list $obj = new object; $obj->table = $xmldb_table; $obj->field = $xmldb_field; $wrong_fields[] = $obj; + } else { + $o.='' . $this->str['ok'] . ''; } $o.=''; } -- 2.39.5