two line patch. hopefully can be backported as well.

1. node_load() should also return the author of the revision.

2. node_revision_list is seriously crippled as its array is not keyed

Comments

killes@www.drop.org’s picture

looks good.

dww’s picture

i'm not sure revision_uid is much help on its own. most of the time, you need both uid and name, and then you just want to hand it to theme('username'), which you still couldn't do...

moshe weitzman’s picture

it is a big help. the caller has a key and can go get name or go get the whole $account object. i won't do another JOIN just to get the name of revision author

dww’s picture

Status: Needs review » Reviewed & tested by the community

fair enough. i hereby remove my reservations.

tested against 5.x (since i fear setting up a HEAD test site for this). ;) works great. code is (obviously) clean and proper. i tried without diff.module enabled. also tried with diff enabled, and my recent work around for this bug (lack of keys on the node_revision_list() array) commented out... all is well. also, just to be paranoid, i greped core for node_revisions_list(), and only the revisions tab uses the function, and it (obviously) isn't confused by having meaningful keys. RTBC.

i consider the lack of keys on node_revision_list() a bug, but the revision_uid thing a feature, so not sure what to do with the category (and therefore prospects for backporting)... so, i'll leave that to moshe and others to fight over. ;)

dries’s picture

I'd say that in 99% of the case this information in not required/useful. Why would we bother to load if for every node_load()? In the rare case the information is needed, you could do an additional query? Not sure about this.

moshe weitzman’s picture

thats true. to answer the question, we would bother because there is virtually zero cost ... if the committers prefer, we can delete the hunk about node_load() and take the node_revision_list() fix.

dww’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new828 bytes

bump: code freeze approacheth... is this going to make it in?

however, old patch no longer applies. here's a version with *just* the keys on $revisions[], which is the only really important change from this patch IMHO (and if Dries doesn't want revision_uid, he can just commit this one).

new patch for both parts that applies to today's HEAD coming up next...

dww’s picture

StatusFileSize
new2.2 KB

here's a patch that includes the revisions keys and the revision_uid in node_load(). i agree, there's virtually zero cost -- we're already joining {node_revisions} in this query. however, in some cases, you really need this info, and it sucks to force modules to redo another entire query just for this other field.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

RTBC. Committers - please choose one of the last two patches as you see fit.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

dww’s picture

thanks, dries. @moshe, FYI: he committed #7, not #8. oh well... ;)
FYI: short blurb added to upgrade docs: http://drupal.org/node/114774#node-revision-list

drumm’s picture

I don't think I will backport this since it changes the return value of an API function and the key is not essential since the vid is in each object.

Anonymous’s picture

Status: Fixed » Closed (fixed)