Small change in rename_field() so objects won't become modified at all

in the process.

Merged from MOODLE_17_STABLE
This commit is contained in:
stronk7
2006-10-12 12:28:36 +00:00
parent e7dcb0fccc
commit 906eebf6ad
3 changed files with 13 additions and 9 deletions

View File

@ -370,10 +370,11 @@ class XMLDBpostgres7 extends XMLDBgenerator {
if ($xmldb_field->getEnum()) {
/// Drop the current enum
$results = array_merge($results, $this->getDropEnumSQL($xmldb_table, $xmldb_field));
/// Change field name
$xmldb_field->setName($newname);
/// Change field name (over a clone to avoid some potential problems later)
$new_xmldb_field = clone($xmldb_field);
$new_xmldb_field->setName($newname);
/// Recreate the enum
$results = array_merge($results, $this->getCreateEnumSQL($xmldb_table, $xmldb_field));
$results = array_merge($results, $this->getCreateEnumSQL($xmldb_table, $new_xmldb_field));
}
return $results;