Problem/Motivation

When you want to uninstall the AddThis module while you already added fields its may seam that you can not do that. The reason is that core creates a depedency for the field to the module. To uninstall the module you need to remove the fields first. But then you still can't do it imidiatly because the fields are first marked for deletion. With the next cron run they get deleted and the module can be uninstalled.

Its seams like a bug but actualy it works as designed by core.

Proposed resolution

In my opinion we don't need to create some kind of fix for this. It works as designed, but it is important for people to have documentation on d.o. to understand what is going on.

Remaining tasks

Therefore we need to create a documentation page that explains the uninstall process.

Original report by dropbydrop

I cannot remove the module, because "Required by: Drupal (Fields pending deletion)"

I have already deleted the field from the content type, I have cleared caches, run cron, but still it does not let me disable.

The reason that I want to disable the module, is that it loads extra js to ALL pages, even if i don't need it in that specific page.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dropbydrop’s picture

Status: Active » Fixed
matglas86’s picture

Can you explain how you fixed it? What is a misunderstanding or what something really broken?

dropbydrop’s picture

I don't know. I just see it fixed. Maybe the new dev version fixed it

matglas86’s picture

Great. Thanks for posting back.

matglas86’s picture

Title: Cannot remove module » Cannot remove module: "Fields pending deletion"
Status: Fixed » Closed (works as designed)

The problem described it not a bug but it works as designed.

To uninstall the module you need to remove all the AddThis fields first. Then the removed field are unlinked from any entities and marked for deletion. The module page will say "Fields pending deletion" as a 'Required by' at the AddThis module. This actually means that when the next 'garbage collect' is done through the cron job the fields are deleted and the requirement is removed from the module.

Solution: run the cron job at the top of the page.

Hope this helps.

dropbydrop’s picture

Probably that was it that fixed it automatically. The garbage collect of cron.
Is this information included in documentation?

matglas86’s picture

Title: Cannot remove module: "Fields pending deletion" » Document > Uninstalling the module
Component: Code » Documentation
Category: bug » task
Status: Closed (works as designed) » Needs work

No this information not included in the documentation. Not yet atleast. I'll put a reference in the meta issue to document this also in the AddThis book page. We need to create a page to describe how to uninstall the module.

If you are willing to write a short description you are more than welcome. :)

Triumphent’s picture

Running cron does not clean anything and the field still hangs in there making uninstall of the program impossible. The way to solve this is by going into the database and looking for the name of the module in the system table. Next to the column where the name is located is a column called Status. When it has a 1 that means the module is enabled. Edit this 1 and change it to zero. Save. When you go back to your module page you will see that the module is now disabled. You can now uninstall it using Uninstall to remove all data pertaining to the module. :)

malcolm’s picture

For those who are not familiar with database operations and/or layout, and using phpmyadmin, to find the appropriate table, after you have clicked on "system" in the left hand column, click the "Browse" tab at the top of the main content area. If you've just installed AddThis, go to the last page in this section. Someone correct me if I'm wrong, but it looks like the tables are created chronologically, according to the order in which you added the modules.

Click on the little pencil icon to edit the AddThis entry. From there, you can change the Status to "0".

Cheers!

sstedman’s picture

Thanks Malcolm.

Deleted all fields, ran cron, Flushed cache, googled endlessly to figure out why I could not shut the module off. Turns out you need to manually edit the db??

Can we please put this in the UI or otherwise make "Required by: Drupal (Fields pending deletion)" reflect the fact that the field dependencies are deleted and cron has been run? I think that this issue needs more than just documentation.

sstedman’s picture

Issue summary: View changes

Added explenation for the problem and what we need to do know.

matglas86’s picture

Issue summary: View changes
Status: Needs work » Active

Maybe this blog provides some help to be able to fix this problem completly. It shows how to delete everything related to the fields.

http://www.bluespark.com/blog/uninstalling-and-purging-field-modules-all...

teknikqa’s picture

Status: Active » Needs review
FileSize
1.11 KB

Here is a patch that does a clean disable and uninstall of the module after removing all fields in the database.

teknikqa’s picture

I should have mentioned this in the patch itself. The original code comes from here -
https://www.bluespark.com/blog/uninstalling-and-purging-field-modules-all-once