- Patch #797680 by lyricnz, jbrown: drupal_write_record() unnecessarily sets primary keys while updating.
parent
786ba6e88a
commit
e60d38c781
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue