Commit 680b99fc authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#198187 by mcarbone: resolve conflicts of n.uid and r.uid, so the node author...

#198187 by mcarbone: resolve conflicts of n.uid and r.uid, so the node author uid takes precedence over the revision uid
parent 18dfcb30
......@@ -688,9 +688,15 @@ function node_load($param = array(), $revision = NULL, $reset = NULL) {
$fields = drupal_schema_fields_sql('node', 'n');
$fields = array_merge($fields, drupal_schema_fields_sql('node_revisions', 'r'));
$fields = array_merge($fields, array('u.name', 'u.picture', 'u.data'));
// Remove fields not needed in the query: n.vid and r.nid are redundant,
// n.title is unnecessary because the node title comes from the
// node_revisions table. We'll keep r.vid, r.title, and n.nid.
$fields = array_diff($fields, array('n.vid', 'n.title', 'r.nid'));
$fields = implode(', ', $fields);
// rename timestamp field for clarity.
// Rename timestamp field for clarity.
$fields = str_replace('r.timestamp', 'r.timestamp AS revision_timestamp', $fields);
// Change name of revision uid so it doesn't conflict with n.uid.
$fields = str_replace('r.uid', 'r.uid AS revision_uid', $fields);
// Retrieve the node.
// No db_rewrite_sql is applied so as to get complete indexing for search.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment