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.

CommentFileSizeAuthor
revisioning_triggers_actions.inc_.patch1.03 KBjweowu

Comments

jweowu’s picture

Status: Active » Needs review
rdeboer’s picture

Thanks jweowu,
Looks like the way to go. Will include when I get back from holidays.
Rik

rdeboer’s picture

Assigned: Unassigned » rdeboer
Status: Needs review » Fixed

Patch committed. Available in versions dated 20-Nov-09 or later.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.