Closed (fixed)
Project:
Drupal core
Version:
x.y.z
Component:
node system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
9 Sep 2006 at 04:06 UTC
Updated:
24 Nov 2006 at 19:45 UTC
Jump to comment: Most recent file
This patch moves the SQL query for deleting a node type out of the node_type_delete_confirm_submit() function (in content_types.inc), and into a new node_type_delete() function (in node.module). This was meant to go in with the original pre-CCK patch, but for some reason didn't seem to make it.
This is an important CRUD mechanism for the new configurable content types functionality, and as such it shouldn't be embedded as part of a specific _submit callback. It should be in its own reusable function (just as node_type_save() already is). Therefore, I think that this patch should go in for Drupal 5.0.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | node_type_delete_0.patch | 3.34 KB | Jaza |
| node_type_delete.patch | 1.4 KB | Jaza |
Comments
Comment #1
pwolanin commentedSo this is also where we need the hook for modules to act upon node type deletion?
Comment #2
karens commentedI think we need to add this function to the node_types hook to handle the delete operation. Plus, we need to get the taxonomy module updated to remove deleted node types from its table, as reported in http://drupal.org/node/90497.
Does this patch need to be updated to add this operation to the node_types hook and update the taxonomy module, now that the patch to create the hook has been committed?
Comment #3
Jaza commentedNew patch with the following changes:
node_type_delete()function now invokeshook_node_type()with the'delete'op.node_node_type()function now checks that$opis not'delete', before doing anything. We don't want to touch the'type'field for nodes that are of a type that is being deleted - updating them will render them invalid, and deleting the nodes outright has already been agreed on as an unacceptable course of action.taxonomy_node_type()function now deletes entries from thevocabulary_node_typestable upon deletion of a node type.I tested this patch by creating a node type, creating nodes of that type, creating a vocabulary assigned to the node type, and then deleting the node type. Everything works as it should: nodes do not get touched, and vocabularies have the link deleted (otherwise they're untouched). Setting RTBC.
Comment #4
karens commentedI've tested this patch with latest head and latest cck. Taxonomy and content_type tables get updated correctly and the delete hook triggers my cck delete function, so it seems to be good to go as far as I can see.
I hope we can get this in before the next beta release since lots of people are trying out the cck integration and this is really needed for it to work right.
Comment #5
drummCommitted to HEAD.
Comment #6
(not verified) commented