- Patch #797680 by lyricnz, jbrown: drupal_write_record() unnecessarily sets primary keys while updating.

merge-requests/26/head
Dries Buytaert 2010-08-09 00:13:06 +00:00
parent 786ba6e88a
commit e60d38c781
2 changed files with 7 additions and 1 deletions

View File

@ -5955,6 +5955,12 @@ function drupal_write_record($table, &$record, $primary_keys = array()) {
$serial = $field;
}
// Skip field if it is in $primary_keys as it is unnecessary to update a
// field to the value it is already set to.
if (in_array($field, $primary_keys)) {
continue;
}
if (!property_exists($object, $field)) {
// Skip fields that are not provided, default values are already known
// by the database.

View File

@ -397,7 +397,7 @@ function path_save(&$path) {
$path += array('pid' => NULL, 'language' => LANGUAGE_NONE);
// Insert or update the alias.
$status = drupal_write_record('url_alias', $path, (!empty($path['pid']) ? 'pid' : NULL));
$status = drupal_write_record('url_alias', $path, (!empty($path['pid']) ? 'pid' : array()));
// Verify that a record was written.
if ($status) {