Prevent "id" fields to be renamed. I can cause lots of problems.

This commit is contained in:
stronk7 2006-10-02 16:37:41 +00:00
parent d917ecd46b
commit af72e37237

View File

@ -847,6 +847,12 @@ function rename_field($table, $field, $newname, $continue=true, $feedback=true)
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);
return true; //Field is "id", nothing to do
}
/// Check field exists
if (!field_exists($table, $field)) {
debugging('Field ' . $field->getName() . ' do not exist. Rename skipped', DEBUG_DEVELOPER);