Not sure if this is in the right place. Could someone please move it if it is incorrect.

Using Drupal 5.0_beta_1. After enabling then disabling and uninstalling the book module, the option to associate vocabularies with 'book pages' is still available here 'admin/content/taxonomy/edit/vocabulary/x'. You are even able to successfully associate this uninstalled content type with a vocabulary.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Suuch’s picture

Project: Vocabulary Set » Drupal core
Version: master » 5.0-beta1
Component: Code » taxonomy.module

Moved to project queue

ac’s picture

Thanks for moving that to the right place. It seems that book page is not being removed from the 'node type' table.

ac’s picture

Component: taxonomy.module » book.module

which probably means this is a book.module issue. heh.

webernet’s picture

Title: Not removing book content type » Content types not being removed properly
Version: 5.0-beta1 » 5.x-dev
Component: book.module » node system

This appears to be a valid bug, the entries for node types are not being removed from the node_type table after disabling and uninstalling any of blog.module, book.module, forum.module, and poll.module.

webernet’s picture

Status: Active » Closed (duplicate)
ac’s picture

Status: Closed (duplicate) » Active

I would prefer that that be marked as a duplicate of this (and not because this was posted first). That post does not mention the taxonomy issue which is most definitely a bug. I have noted this on the other issue.

ac’s picture

To clarify, the bug is that you can associate disabled and uninstalled core modules with vocabularies. The reason for this is because they remain in the 'node_type' table.

chx’s picture

Title: Content types not being removed properly » Core uninstalls shall clean up node and node_type table and recalculate node_comment_statistics
chx’s picture

FileSize
3.02 KB

First, untested attempt.

chx’s picture

About the mysql requirement -- we thought we will rise the requirement to 4.0 already, just we have not found any use for it. Now we do. Given the recent agreement using 4.1 in Drupal 6 and the surrounding posts, I can't remember anyone posting 'but hey we are at 3.x still'.

chx’s picture

Status: Active » Needs review

It's a patch. Frightening it might be, but still: a patch.

moshe weitzman’s picture

i think this code is too infrequently run to merit raising the mysql version requirement.

chx’s picture

One could rearrange the code so that mysql 4.1+ and pgsql runs subqueries , mysql 4.0 runs the multitable delete and I leave mysql 3.x for the next patcher.

ac’s picture

When uninstalling get the error

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE n.nid = nc.nid AND nc.nid = nr.nid AND n.type = 'book'' at line 1 query: node_delete_type DELETE FROM node n, node_comment_statistics nc, node_revision nr WHERE n.nid = nc.nid AND nc.nid = nr.nid AND n.type = 'book' in /srv/www/htdocs/includes/database.mysql.inc on line 167.

where n.type equals any one of the patched modules. Otherwise the patch

As well as this the forum uninstall does not remove the forum vocabulary or the forum content type (maybe by design) and the blog module requires function blog_uninstall.

ac’s picture

*Otherwise the patch works fine

drumm’s picture

Status: Needs review » Needs work

I'm guessing ac was using mysql 3.

A loop would be more code, but work all the time and consistently across database versions. Maybe it would take too long to execute if there are too many nodes.

This code is just too rough to commit. Either it should work on the versions of MySQL we support, or handle not working on MySQL 3 with a better error. I didn't notice a clear indication that it was okay to drop MySQL 3 support for Drupal 5.

Either clean it up or postpone for 6.

ac’s picture

MySQL 5 here.

ChrisKennedy’s picture

Status: Needs work » Needs review
FileSize
4.45 KB

Cleaned up and synced with HEAD. The initial patch had forum.module incorrectly remove the poll type. This version also adds blog_uninstall() and fixes the sql error, which was because the table name is node_revisions, not node_revision.

drumm’s picture

Status: Needs review » Needs work

This shouldn't change Drupal's required MySQL version.

eaton’s picture

I'm still concerned by the idea of deleting nodes when a module is uninstalled. I just went through the following process on a client's site:

  1. Set up forums
  2. Get new requirements from client, realize forum.module won't cut it
  3. Disable forum.module, create new 'forum' content type and use views/etc to add custom behaviors
  4. Be happy

If uninstalling the module deletes all nodes of that type, then there is a ticking time bomb waiting on the 'uninstall' screen: if the client ever decides to click that button, since forum.module isn't being used, it will immediately delete all of their site's forum posts.

moshe weitzman’s picture

@eaton - thats just a bug. forum uninstall should assure that it owns the node type = 'forum' before deleting such nodes. just a simple if() will do.

Morbus Iff’s picture

Subscribing.

FiReaNGeL’s picture

It should not only check if it owns the nodes / content in question, but there should be a prompt to ask the user if he wants to delete the content. What if I want to disable forum.module for a week?

moshe weitzman’s picture

@fireangel - uninstall is different from diable. what you describe is disable. uninstall specifically is there so that modules can do this sort if cleanup. uninstall is destructive by design. there are lots of warnings during the process.

FiReaNGeL’s picture

Thanks for the clarification moshe. I think Eaton's comment misled me into thinking that it would also delete the associated content ;)

rconstantine’s picture

Whatever happened to this? I'm developing a module that depends on correct info in the node_type table and I'm finding it isn't. Is there a patch for Drupal 5.1 available? Also, if I can add my two cents worth... it seems to me that Drupal core should be handling the deletion of content type info (at least from 'node_type' and possibly also 'content_type_XXX') when a module is uninstalled since modules don't seem to interject themselves there in the first place. Can anyone tell me what's going on?

Thanks.

pwolanin’s picture

Version: 5.x-dev » 6.x-dev

This should probably be fixed is system module- but I posted a patch here that's a minimal fix: http://drupal.org/node/147061

forngren’s picture

Why is the MySQL min version changed?

We should also tell the user WITH A BIG ANGRY MESSAGE that he is deleting all nodes of this type.

Reroll and I'll review :)

dpearcefl’s picture

is this issue in current 6.x? Is any one interested in pursuing it any more?

doitDave’s picture

@dpearceMN, #29:

Yes, it is still. Just uninstalled forum.module in 6.22. It left alle forum nodes and their comments untouched, but also removed the node_type info. So the abandoned nodes are now of the type "" in the frontend and "forum" in the database. Even worse, when trying to edit such an abandoned node, you will receive:

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'forum_node_form' was given in X:\Internet\Server\test\drupal-6.22\includes\form.inc on line 377.

This is really bad behavior IMO. At a glance, I can see several solution options for that:

  1. Delete the node types on uninstall. (Rough!)
  2. Delete the node types on uninstall and clearly warn. (Also rough but "ayor" then)
  3. Delete the node types on uninstall but create an export function for later reuse (->import function) AND prompt to consider this export . (More convenient, more coding, user friendly, consistent.)
  4. Offer a choice on uninstall whether to
    • delete all module related nodes
    • or offer the option to turn them into an existing node type (although this can be done with some contrib module I do not remember atm, this would refer to solution 2 then)
  5. generally reconsider having an undeletable generic node type that catches all abandoned module nodes as long as no module takes care of them again (IMO the best, as well as the most code expensive option. It would mean doing basic changes to branches that already have successors, on the other hand, at least as for D6, just remember how many people still stick to Windows XP for good reasons ;))

Maybe we can have some opinions on this. At least for D6, I would even contribute myself, but I have to admit that I am not even having full project access as by now (pending). Which, of course, wouldn't keep me from proposing some patches in case there is a demand.

Perhaps I am thinking wrong here and all that may be solved with a contrib module. I would be interested in further opinions.

doitDave’s picture

(Unfollowing)

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.