7

I'v got a question regarding dependencies & configuration. I created a module providing a content type, field type, widget & formatter.

  • While wanting to uninstall the module, I get the following message:

    The following reason prevents module from being uninstalled:

    • Fields type(s) in use
  • So I go to structure, try to delete the content type & get the following:

    module's content type is used by x pieces of content on your site. You may not remove module's content type until you have removed all of the module's content type content.

  • I go delete all my nodes first as it seems this needs to be done first. I retry uninstalling the module & get message:

    Fields pending deletion

  • I run cron & am now able to uninstall my module with message:

    The following modules will be completely uninstalled from your site, and all data from these modules will be lost!

I can see that dependencies are met well, but this gives it a long run before one can uninstall a module. Is there a way I can keep dependency integrity while once I am willing to uninstall the module to automatically remove configuration & content from start till end dependency?

3 Answers 3

5

You can, if you write the code for doing that yourself. Core currently doesn't offer a way to do that automatically.

See Impossible to uninstall Flag and the linked issue for Simplenews for inspiration.

1
  • 1
    Thanks for the reference Berdir! That's what I was looking for
    – baikho
    Commented Dec 22, 2015 at 12:41
3

Google sent me to this page when I was searching for uninstall module drupal 8 "Fields pending deletion". I was unable to uninstall Feeds module with the message Fields pending deletion.

The solution was to run the cron several times.

See this.

1
0

The problem with cron is that you might have to run it very often, and it might only start to work after fix hours.

But here's how to force Drupal to clear out fields pending deletion:

drush php:eval 'field_purge_batch(50000);' 

You may need to provide an even bigger value. When this command returns quickly, uninstall will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.