]> git.mjollnir.org Git - moodle.git/commitdiff
Prevent "id" fields to be renamed. I can cause lots of problems.
authorstronk7 <stronk7>
Mon, 2 Oct 2006 16:37:41 +0000 (16:37 +0000)
committerstronk7 <stronk7>
Mon, 2 Oct 2006 16:37:41 +0000 (16:37 +0000)
lib/ddllib.php

index 6b0a8a418e05000bb909b39816ca71349d238110..5067eaad309e8c939110182b83560b33d75ac3eb 100644 (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);