Closed (fixed)
Project:
Web Links
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Jul 2009 at 02:08 UTC
Updated:
10 Sep 2015 at 16:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
nancydruHmm, I guess it's because core doesn't tell us... #524726: Add hook_node_revert_revision()
Comment #2
jonathan1055 commentedI've just tested this in Weblinks 7.x and confirm that it is a problem. If you revert to a previous version the weblinks table gets a new row (with the new vid) but the data (url, click count, last status, etc) is copied from the current revision not the one being reverted to.
The feature request for a dedicated hook_node_revert_revision has been pushed back to D8 and downgraded to normal priority, because the functionality can be achieved using the normal hook_update. This needs fixing now, so I will work on it.
When reverting a node
$node->revisionis set to 1 and$node->old_vidholds the vid of the version which is being reverted to, so we can use this to get the weblinks data and update the $node objectComment #3
nancydruCool beans
Comment #4
gstegemann commentedOK, sounds promising.
Comment #5
jonathan1055 commentedHere's a patch to hook_update. Hopefully I've explained it OK in the comments. I thought that this code should go after the possible reset of click count data, so that on reverting to an old revision the old click data is also restored.
Below are the devel module debug lines I used, in case you want to see what is going on internally.
Comment #6
gstegemann commentedThanks. I will test the patch on return from my vacation in two weeks.
Comment #7
jonathan1055 commentedI'm going on vacation in a few days time, will be returning when you return. Have a nice time :-)
Comment #8
gstegemann commentedI hope you had a nice time as well.
Back to Web Links: tested and works. Thanks.
Comment #10
jonathan1055 commentedYes I had a very good holiday, thank you. Funny that we both picked exactly the same two weeks.
I am tempted to leave this as fixed in D7. Or do you think we should also fix D6? No one has asked for the correction, but I am happy to do it if/when anyone asks.
Comment #11
gstegemann commentedYes, that's really funny,
No, unless someone asks for the correction.
Comment #13
jonathan1055 commentedThe commit in #12 removes to changes to weblinks_form_alter() which mistakenly got added after I started working on #2550025: Sort by weight using Weight module. They do not affect the functionality, but I've undone the change to make the next patch in that issue cleaner and easier to read.
Comment #14
gstegemann commentedOK. I have re-installed the todays version and will wait for the next patch for issue #2550025: Sort by weight using Weight module.