Can't uninstall without deleting all blocks

Created on 18 February 2020, almost 5 years ago
Updated 28 June 2023, over 1 year ago

Can I uninstall the module without deleting all blocks in my site? I disabled the field in every block but uninstall wants to remove all my blocks.

I want to remove the module because this issue β†’ . I see that be more convenient to display and hide the blocks from CSS because a lot of phones isn't listed in the module.

Thanks for your time.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡¦πŸ‡·Argentina renguer0

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.

  • πŸ‡ΊπŸ‡ΈUnited States hummeldon

    Our team has had this module sitting unused and unable to uninstall for the same reasons. I finally wanted to take a stab and fixing the issue.

    Problem

    Uninstalling Mobile Device Detection will delete blocks that have the module listed as a dependency.

    Solution

    Added code to the mobile_device_detection_uninstall() hook to iterate through all config files with the block.block prefix:

    1. Removes instances of 'mobile_device_detection' under dependencies.module
    2. Removes instances of 'mobile_device_detection' under visibility

    Notes

    Drupal will warn you of blocks that will be deleted on uninstall. I believe this is because Drupal detects the dependencies prior to the uninstall hook resolving the dependency issues. In my testing with this patch, these are false alarms.

    To aid users with identifying affected blocks, I've included a log notice upon uninstall that mentions any blocks that were modified.

    This patch is not intended to included in a release of this module. It is simply to assist others with uninstalling this unmaintained and problematic module. My suggestion would be that this module be fully retired and point users to Mobile Detect β†’

    Finally, I want to stress that you should absolutely test this in a dev environment before attempting to use it on a production environment. Regardless of my experience with the patch, there is still a risk that blocks will be deleted and you should be certain it works in your environment beforehand.

    Also, this is my first ever contribution to the Drupal community! I hope this helps people out.

Production build 0.71.5 2024