If we're going to offer a hook_uninstall for core, it needs to:

1) remove all content created.
2) remove any non-dynamic node types.
3) remove any created variables.

Currently, forum.module seems to only do 3) correctly - 1) is partially implemented (it deletes from node, but leaves node_revisions untouched). It also leaves behind the forum post node type in the node_type table. Poll module cleans up its tables, but doesn't appear to touch any of its created nodes or variables (if any, didn't check).

Comments

morbus iff’s picture

 DELETE node, node_revisions FROM node, node_revisions WHERE node.nid = node_revisions.nid AND node.type = 'poll';

is how you'd do it in MySQL. According to #postgresql, however, there's no way to delete from two tables at the same time. So, instead, we're looking to do two different queries it seems: one to get all the nids that match, then another to DELETE IN (nids).

dww’s picture

in postgresql, what's wrong with:

DELETE FROM {node_revisions} USING {node} WHERE node.nid = node_revisions.nid AND node.type = 'poll';
DELETE FROM {node} WHERE node.type = 'poll';

?

morbus iff’s picture

Status: Active » Needs review
StatusFileSize
new2.28 KB

Here's a first attempting using both my and dww's SQL. There's still the larger issue of deleting the Forum taxonomy stuff. We could probably rig something up using the same SQL for that, but the amount of tables would make the SQL a bit convoluted, I think. May be better to reduce it to an IN (), as above.

morbus iff’s picture

StatusFileSize
new2.28 KB

Typo in forum_uninstall.

killes@www.drop.org’s picture

I'd leave the forum vocab as such alone. People someimtes use the same vocab for site navigation or something else.

ChrisKennedy’s picture

Status: Needs review » Closed (duplicate)