Some old PG sites have user->firstname and user->lastname

defined to be 30cc. Repair them. MDL-7110
This commit is contained in:
stronk7
2007-01-21 19:56:05 +00:00
parent 63f2e6ba1d
commit 9fc57f4c22
2 changed files with 36 additions and 1 deletions
+35
View File
@@ -524,6 +524,41 @@ function xmldb_main_upgrade($oldversion=0) {
}
}
if ($result && $oldversion < 2007012100) {
/// Some old PG servers have user->firstname & user->lastname with 30cc. They must be 100cc.
/// Fixing that conditionally. MDL-7110
if ($CFG->dbfamily == 'postgres') {
/// Get Metadata from user table
$cols = array_change_key_case($db->MetaColumns($CFG->prefix . 'user'), CASE_LOWER);
/// Process user->firstname if needed
if ($col = $cols['firstname']) {
if ($col->max_length < 100) {
/// Changing precision of field firstname on table user to (100)
$table = new XMLDBTable('user');
$field = new XMLDBField('firstname');
$field->setAttributes(XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, null, null, 'idnumber');
/// Launch change of precision for field firstname
$result = $result && change_field_precision($table, $field);
}
}
/// Process user->lastname if needed
if ($col = $cols['lastname']) {
if ($col->max_length < 100) {
/// Changing precision of field lastname on table user to (100)
$table = new XMLDBTable('user');
$field = new XMLDBField('lastname');
$field->setAttributes(XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, null, null, 'firstname');
/// Launch change of precision for field lastname
$result = $result && change_field_precision($table, $field);
}
}
}
}
return $result;
}
+1 -1
View File
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
$version = 2007011200; // YYYYMMDD = date
$version = 2007012100; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.8 dev'; // Human-friendly version name