There is an issue with the patch committed here: http://drupal.org/node/895622#comment-4034336
In hook_nodeapi($op='update'), the $node object is not fully loaded. As a result, editing a node will result in a new UUID be created & saved for it. You can read more about $node not being fully loaded w/$op='update' starting here: http://drupal.org/update/modules/5/6#comment-1087468
The attached patch loads the node at the beginning of the "case 'update':" in hook_nodeapi().
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | uuid_1065364_6.patch | 3.05 KB | ryan_courtnage |
| #8 | uuid_1065364_5.patch | 1005 bytes | ryan_courtnage |
| #6 | uuid_1065364_4.patch | 860 bytes | ryan_courtnage |
| #4 | uuid_1065364_3.patch | 1.73 KB | ryan_courtnage |
| #3 | uuid_1065364_2.patch | 1.78 KB | ryan_courtnage |
Comments
Comment #2
q0rban commentedsubscribe
Comment #3
ryan_courtnage commentedSorry, I hadn't run the tests before uploading. Made a stupid mistake by loading into $node, as I was clobbering any changes from the node edit. I'm now loading into a new variable.
Everything seems to behave the way it should to me. All of the tests pass, expect for 3 that deal with programmatically changing the uuid when calling node_save(). I'm not sure I understand the use-case. It could be that the tests themselves should be updated. q0rban, I may need your help with this.
Comment #4
ryan_courtnage commentedA minor tweak. Still 3 fails.
Comment #6
ryan_courtnage commentedOkay, I've got it now. Not sure why I didn't take this approach to begin with..
@q0rban, your tests are absolutely fantastic. Without them, one of my previous patches could have slipped through. Thank You!
Comment #7
q0rban commentedGreat, I'm glad it helped, although most of the credit for those tests go to mike ryan and ezra-g I believe. I only expanded what they had. :)
I think this could be simplified to not run a complete node_load:
Comment #8
ryan_courtnage commentedI smacked myself on the forehead after posting that comment and then looking at the CVS history for the tests. Doh! :P Either way, great tests. Attached is a modified patch that doesn't node_load().
Comment #9
q0rban commentedLooks great, Ryan! The only thing I would change is to add some commenting above it to highlight why this is necessary. Probably the description from your original comment would work well, and a reference to this issue. :)
Comment #10
recidive commentedHi @ryan_courtnage, thanks for the patch. It looks good.
Please add the comments and I'll commit it.
Comment #11
q0rban commentedIt would also be nice to have a test for this bug, but I'm not sure how you would even generate a test for this. It must be something that occurs only when editing a node via the UI.
Comment #12
ryan_courtnage commentedI was thinking about this myself. I imagine that submitting the node edit form with a drupalPost would suffice. I'll try some things this evening.
Comment #13
ryan_courtnage commentedOkay, here it is with the requested comments, as well as a web test that will fail nicely without the change, and will pass with it.
Comment #14
recidive commentedCommitted! Thanks!
Comment #16
aschiwi commentedI have a question about this. The patch works, but I'm wondering why I get uuid_node_revision entries in the first place. I have automatic uuid creation turned off for all content types, I'm only using it to get terms into a site using a Feature. After running update #6005 I now have 41,883 entries in the uuid_node_revision table. I also have entries in uuid_node, but I think I shouldn't have entries in either of these tables?
Comment #17
apotek commented@aschiwi Please create a new issue for the problem you are having above. They may well be related, but this issue, and the patch that was created for it, have solved *this* issue, and it's better if we close this and open another one for the issue you have identified. Keeps things much cleaner that way.