MDL-35691 use bigint checker for all integers

This commit is contained in:
Petr Škoda
2012-10-06 10:07:49 +02:00
parent 47f51b6989
commit 2b7fa4c175
2 changed files with 8 additions and 3 deletions
@@ -59,19 +59,24 @@ class check_bigints extends XMLDBCheckAction {
$o.=' <ul>';
foreach ($xmldb_fields as $xmldb_field) {
// If the field isn't integer(10), skip
if ($xmldb_field->getType() != XMLDB_TYPE_INTEGER || $xmldb_field->getLength() != 10) {
if ($xmldb_field->getType() != XMLDB_TYPE_INTEGER) {
continue;
}
// If the metadata for that column doesn't exist, skip
if (!isset($metacolumns[$xmldb_field->getName()])) {
continue;
}
$minlength = $xmldb_field->getLength();
if ($minlength > 18) {
// Anything above 18 is borked, just ignore it here.
$minlength = 18;
}
// To variable for better handling
$metacolumn = $metacolumns[$xmldb_field->getName()];
// Going to check this field in DB
$o.=' <li>' . $this->str['field'] . ': ' . $xmldb_field->getName() . ' ';
// Detect if the physical field is wrong
if (($metacolumn->meta_type != 'I' and $metacolumn->meta_type != 'R') or $metacolumn->max_length < 10) {
if (($metacolumn->meta_type != 'I' and $metacolumn->meta_type != 'R') or $metacolumn->max_length < $minlength) {
$o.='<font color="red">' . $this->str['wrong'] . '</font>';
// Add the wrong field to the list
$obj = new stdClass();
+1 -1
View File
@@ -101,7 +101,7 @@ $string['generate_documentation'] = 'Documentation';
$string['gotolastused'] = 'Go to last used file';
$string['change'] = 'Change';
$string['charincorrectlength'] = 'Incorrect length for char field';
$string['checkbigints'] = 'Check bigints';
$string['checkbigints'] = 'Check integers';
$string['check_bigints'] = 'Look for incorrect DB integers';
$string['checkdefaults'] = 'Check defaults';
$string['check_defaults'] = 'Look for inconsistent default values';