summaryrefslogtreecommitdiff
path: root/modules/node/node.module
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-25 02:48:16 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-25 02:48:16 +0000
commit61035e444631b3f7573ffe2207c3f1d1e4268fbb (patch)
treec9f8c11c9f9036bc0e6de85fa87d61b51d90b682 /modules/node/node.module
parent4d85fb1f565fd783e9fa6f6e77d4b24503cd449e (diff)
downloadbrdo-61035e444631b3f7573ffe2207c3f1d1e4268fbb.tar.gz
brdo-61035e444631b3f7573ffe2207c3f1d1e4268fbb.tar.bz2
#492186 by catch, mfb, BTMash, TheRec, and rainbreaw: Fixed bug causing authoring information to never be updated (with tests).
Diffstat (limited to 'modules/node/node.module')
-rw-r--r--modules/node/node.module20
1 files changed, 12 insertions, 8 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index b915d7e77..fa5cfc832 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -799,21 +799,25 @@ function node_load_multiple($nids = array(), $conditions = array(), $reset = FAL
// The columns vid, title, status, comment, promote, moderate, and sticky
// are all provided by node_revision, so remove them.
- foreach (array('vid', 'title', 'status', 'comment', 'promote', 'moderate', 'sticky') as $column) {
- unset($node_fields[$column]);
- }
+ $node_fields = array_diff($node_fields, array('vid', 'title', 'status', 'comment', 'promote', 'moderate', 'sticky'));
$query->fields('n', $node_fields);
// Add all fields from the {node_revision} table.
$node_revision_fields = drupal_schema_fields_sql('node_revision');
- // nid is provided by node, so remove it.
- unset($node_revision_fields['nid']);
+ // {node_revision}.nid is provided by node, and {node_revision}.uid and
+ // {node_revision}.timestamp will be added with aliases, so remove them
+ // before adding to the query.
+ $node_revision_fields = array_diff($node_revision_fields, array('nid', 'uid', 'timestamp'));
+ $query->fields('r', $node_revision_fields);
+
+ // Add {node_revision}.uid with alias revision_uid to avoid the name
+ // collision with {node}.uid, otherwise the revision author would be loaded
+ // as $node->uid.
+ $query->addField('r', 'uid', 'revision_uid');
- // Change timestamp to revision_timestamp before adding it to the query.
- unset($node_revision_fields['timestamp']);
+ // Add {node_revision}.timestamp with alias revision_timestamp for clarity.
$query->addField('r', 'timestamp', 'revision_timestamp');
- $query->fields('r', $node_revision_fields);
if ($nids) {
$query->condition('n.nid', $nids, 'IN');