node_load() should pass arguments $revision, $reset to node_invoke() and node_invoke_api() for $op == load

Created on 31 January 2007, over 17 years ago
Updated 19 June 2023, about 1 year ago

I submit this patch strictly from a recent experience I had when I was trying to make use of the $reset parameter. In my case, I was writing an import script where lines of CSV were being parsed from a file. Each line of CSV had the potential to alter the taxonomy of an existing node. With the data we were getting for this import script, multiple lines in the data were adding to the taxonomy of an existing node. Keeping this in mind, I would call node_load($nid, NULL, TRUE), where the 'TRUE' in the call was the $reset parameter (this loaded node would be saved at the end of the loop). Unfortunately, I discovered, the node_invoke_nodeapi() and node_invoke() functions did not pass the $reset parameter to the node hooks. In my case, this was a problem, because taxonomy_nodeapi() relies on (in a helper function) a php static array when loading the taxonomy for a node. Of course, if the taxonomy of a node has changed during the execution of a script, a later loading would only return the first array of taxonomy terms loaded for the node, in spite of the $reset parameter being set to TRUE.

Of course, for this patch to be useful, other core modules will need to make use of the $revision and $reset parameters in their node hooks. I am willing to submit patches to this end if this one is accepted.

I also argue that this is the way to go just to make the loading function consistent across the hooks.

-Ankur

πŸ“Œ Task
Status

Postponed: needs info

Version

9.5

Component
Node systemΒ  β†’

Last updated less than a minute ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States ankur

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024