Lots of node actions update a node object in memory, but do not save it to the database. They flag this by setting 'changes_node_property' in their hook_action_info() definition. trigger_assign_form_submit() picks up on that property, and appends 'node_save_action' to the list of actions, and the changes made by the earlier actions are saved to the database when that last action runs.
revisioning_revisioning() does a loop over all the assigned actions, and for node actions it does a node_load() to obtain the object for every node action.
This node_load() destroys any in-memory changes made by 'changes_node_property' actions. When the final 'node_save_action' is run, it is effectively loading and saving an un-modified copy of the node.
I've attached a patch which loads the updated node object once only. I've tested this briefly for the 'publish' op, and it appears to do what I want, but I don't know enough about this module to know whether there are side-effects to this approach.
The $reset = TRUE argument to node_load() is because the trigger is called after functions like _revisioning_publish_revision() have directly updated the database, so node_load() would otherwise return the cached (and un-modified) version of the object.
| Comment | File | Size | Author |
|---|---|---|---|
| revisioning_triggers_actions.inc_.patch | 1.03 KB | jweowu |
Comments
Comment #1
jweowu commentedComment #2
rdeboerThanks jweowu,
Looks like the way to go. Will include when I get back from holidays.
Rik
Comment #3
rdeboerPatch committed. Available in versions dated 20-Nov-09 or later.