Prevent rename_field() to be executed if no full specs of

the original field are provided. MDL-8296
This commit is contained in:
stronk7
2007-01-24 17:54:53 +00:00
parent 704b9031ac
commit bb3172c038
+6
View File
@@ -896,6 +896,12 @@ function rename_field($table, $field, $newname, $continue=true, $feedback=true)
return false;
}
/// Check we have included full field specs
if (!$field->getType()) {
debugging('Field ' . $field->getName() . ' must contain full specs. Rename skipped', DEBUG_DEVELOPER);
return false;
}
/// Check field isn't id. Renaming over that field is not allowed
if ($field->getName() == 'id') {
debugging('Field ' . $field->getName() . ' cannot be renamed. Rename skipped', DEBUG_DEVELOPER);