[drupal-devel] [bug] Deleting revision also deletes a node's taxonomy mappings

Jaza drupal-devel at drupal.org
Sun Jun 5 12:54:24 UTC 2005


Issue status update for http://drupal.org/node/24336

 Project:      Drupal
 Version:      cvs
 Component:    node.module
 Category:     bug reports
 Priority:     normal
 Assigned to:  Jaza
 Reported by:  Jaza
 Updated by:   Jaza
 Status:       patch
 Attachment:   http://drupal.org/files/issues/node.module.revision_delete_fix.patch (595 bytes)

This bug is caused by the revisions for a node being managed on the
node/x/revisions page, rather than the node/x/edit page. When a
revision is deleted, it calls node_save(). But node_save() assumes that
it is being called from the node editing page. It grabs all the
submitted values for a node, and then invokes the _nodeapi() (and
_update()) hook to see what extra values it needs to grab.


Over in taxonomy.module, taxonomy_nodeapi() calls taxonomy_node_save(),
which tries to grab the taxonomy mappings for the node. But since none
were submitted (because it's not the node editing form), it clears the
old values, and then inserts the newly submitted values (i.e. NOTHING)
into the database.


This bug addresses the issue, by only invoking the hooks if the
previous page was node/x/edit. I don't know how the core node fields
manage to get saved, since they're not submitted either. But anyway,
the main thing is that core fields don't seem to be affected by this
bug. And with the patch, taxonomy mappings aren't affected either. This
patch probably addresses the same problem for fields that other modules
define through _nodeapi() - haven't checked this, though.




Jaza




More information about the drupal-devel mailing list