Automatically remove module's nodes upon module uninstallation

Created on 4 August 2010, over 14 years ago
Updated 29 January 2024, 11 months ago

I've looked into both #232327: Deleting node type leaves orphan nodes and #400450: Be more graceful when editing nodes with disabled node types both have relevant information but neither completely seem correct and core maintainers have different views on the subject.

To get down to the bottom of this something has to be decided, do we leave the data and mark it disabled on uninstall or do we remove it completely. Here's an example?

I'm working on the quotes update in contrib for D7. It uses the node module but the body is actually stored in {fields_data}, ok no problem unless you uninstall the module. what happens when you do is the modules schema is uninstalled, so we lose data there, the fields entity is removed, just lost the body but the {node} table retains the title, nid, vid, also {node_revision} still retains the orphaned data. However, what good is the data if it's been corrupted, and without a body what good is it at all. At this point we then have theoretically wiped out menu links, etc.., etc.., etc.. and the system should ignore those nodes.

Ok, now for some reason, I decide to re-install the module. Ooops, error messages galore and no way fix them without being able to access the database. Then even if you can access the database will the average user be able to manipulate it to clear up the mess left behind by the orphaned nodes.

So what is the answer? do we leave the data or completely delete it? My vote would be to fix the uninstall process by deleteing the orphaned nodes residing in both the {node} and {node_revision} table since it is useless without the body that has been removed already through the un-install process. Is this a function that contrib needs in thier uninstall? if so then why was it decided to uninstall the scheme by core instead of through contrib? I believe the reason was to alleviate database corruption on a system level.

However, I can see the use of keeping the data as well for archival purposes but if that is the way it is to be done then anything field related that's deleted by a uninstall needs to be kept. Either way is fine. As late as it is in the D7 cycle, however, I would suggest the easier fix of deleting and then as catch said in one of the prior linked posts to make an archival system for D8. While this may not be a beta-blocker for D7, it needs to be fixed before the official release.

Feature request
Status

Needs work

Version

9.5

Component
Node system 

Last updated 4 days ago

No maintainer
Created by

🇺🇸United States ctmattice1

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
Production build 0.71.5 2024