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

Todd Grimason todd at slack.net
Thu Aug 18 23:46:28 UTC 2005

Sorry if this isn't the right etiquette - I have a question(s) about
this issue which didn't seem right to clutter up the "official" issue
comments with:

Why is node_save() called before the insert/update event fires (called
via nodeapi) and not after? It seems a bit arbitrary. 

I guess there are situations where you don't want to fire that until the
node is saved, but that would seem to preclude anything else from
modifying that node without having to save it again. Was this a decision
to be a bit more simple and accept the requirement of other modules
having to re-save if they want to modify the node itself, and not just
affect other things?

Maybe what's needed is this:

Well I'm sorta joking, but the key thing here is as far as I can see
(not very, I'm fairly new to the deep internals of drupal) is having a
distinction between pre- and post-save  [aka insert/update], since "on
save" is ambigious isn't it? (well in name at least, the actual behavior
in this case it appears to actually be a "post save" event, right?).

Until I followed all the calls around, I assumed the callbacks had a
chance to run before node->save was actually called -- like everyone
gets to do their thing before the node is stored away in the DB -- but
now I see you actually gotta use your copy and stick it in the database
yourself, basically overwriting the core functionality -- so potentially
you could have 0..* saves in response to the insert/update callback,

Am I anywhere near understanding what's going on here?


toddgrimason*todd[ at ]slack.net

More information about the drupal-devel mailing list