Here is what I experienced:
1. Called node_type_delete('my_content_type') from hook_uninstall()
2. node_type_delete() deleted from {node_type}
3. node_type_delete() called node_get_types(), which had not yet been initialized
4. node_type_delete() called module_invoke('node_type', 'delete', $info) with an empty variable
5. content_type_delete() failed
As-is, it works when deleting content types from the administrative page. We didn't notice this problem until now because node_menu() calls node_get_types() for the administrative pages, which initializes a static variable before node_type_delete() deletes from {node_types}.
The attached patch swaps two lines, calling node_get_types() before deleting from {node_type} in every case.
I experienced this with Drupal 5.x, but I see the same thing in Drupal 6.x so I am marking this for 6.x-dev.
| Comment | File | Size | Author |
|---|---|---|---|
| node_type_delete_3.patch | 486 bytes | njivy |
Comments
Comment #1
dmitrig01 commented+1. Great. I would mark it as RTBC if more people reviewed it.
Comment #2
hunmonk commentedthis is still a problem i ran into in HEAD when working on http://drupal.org/node/180432
tested, and works as advertized.
Comment #3
gábor hojtsyThanks, committed.
Comment #4
gábor hojtsyErm, also an issue in 5.x, so needs backporting.
Comment #5
marcingy commentedMarking as won't fix as d5 is end of life.