summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-12-10 10:52:52 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-12-10 10:52:52 +0000
commit680b99fcbaed120d4253a4bed397c81c22c58209 (patch)
tree81e2a899706a55016d613eae3495592310effa73
parent18dfcb30ed3f42d294f881db5e76f0aaf1bc0d1c (diff)
downloadbrdo-680b99fcbaed120d4253a4bed397c81c22c58209.tar.gz
brdo-680b99fcbaed120d4253a4bed397c81c22c58209.tar.bz2
#198187 by mcarbone: resolve conflicts of n.uid and r.uid, so the node author uid takes precedence over the revision uid
-rw-r--r--modules/node/node.module8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index fae77fe64..0722b9be5 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -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.