Problem/Motivation

Modules required by themes can be uninstalled and theme requirements are not listed in the module list (/admin/modules) as Required for: ...

Steps to reproduce

Install a theme that declares dependencies in its .info.yml
See the modules list (/admin/modules) as Required for: ... does not list the theme as dependency
/admin/modules/uninstall does not disallow uninstalling the module
After uninstallation the theme might be broken and the "Designs" page (/admin/appearance) shows the missing module.

Proposed resolution

  1. Also consider themes when listing dependencies
  2. Prevent uninstalling a module that is a theme dependency

Remaining tasks

  1. Discuss
  2. Implement
  3. Test
  4. Release

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3614602

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

anybody created an issue. See original summary.

mstrelan’s picture

Component: system.module » extension system

This is probably one for the extension system, unless this is only a problem with the form. Can this also be reproduced with drush?

anybody’s picture

Title: Modules required by themes can be uninstalled » Modules required by an active theme can be uninstalled

You're right @mstrelan!

Drush (at least as far as I know) does never prevent you from uninstalling a module which has dependencies, but also uninstalls the dependencies without asking.

To be sure I just tried it and it definitely just installs modules which are required by a theme.

longwave-bot made their first commit to this issue’s fork.

longwave’s picture

Status: Active » Needs review
anybody’s picture

Thanks @longwave - LGTM!

Running test-only. If it's fine I think this is good to go!

anybody’s picture

Status: Needs review » Reviewed & tested by the community
anybody’s picture

Test-only fails as expected, thank you for the fix!!

catch’s picture

Status: Reviewed & tested by the community » Needs work

Couple of comments on the MR.

longwave’s picture

Status: Needs work » Reviewed & tested by the community

Feedback addressed, back to RTBC as it was all minor.

  • amateescu committed c2dc9ad5 on 11.4.x
    fix: #3614602 Modules required by an active theme can be uninstalled
    
    By...

  • amateescu committed 99ec722f on 11.x
    fix: #3614602 Modules required by an active theme can be uninstalled
    
    By...

  • amateescu committed 3c5ba5ef on main
    fix: #3614602 Modules required by an active theme can be uninstalled
    
    By...
amateescu’s picture

Version: main » 11.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 3c5ba5ef893 to main and 99ec722f364 to 11.x and c2dc9ad5c83 to 11.4.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.