[drupal-devel] [bug] Make node_save() recursion-aware

Kjartan Mannes kjartan at zind.net
Fri Aug 19 07:31:30 UTC 2005


Friday, August 19, 2005, 1:48:35 AM, Todd Grimason wrote:
> Why is node_save() called before the insert/update event fires (called
> via nodeapi) and not after? It seems a bit arbitrary. 

Basically when you get to the _save part the node should be finalised,
and all that remains is saving it.

All modifications should be done during _validate.

The reason node_save is called before results in a clean $node object,
as it is re-fetched after saving it. Then the module that defines the
node can save it's stuff, just to prevent other modules from screwing
with its data, then the nodeapi is triggered to save all the other
stuff.

-- 
Kjartan <kjartan at zind.net>
:: "Programming is like sex: one mistake and you have to
    support it for the rest of your life." - Michael Sinz




More information about the drupal-devel mailing list