ModuleInstaller should validate module requirements

Created on 7 June 2019, about 5 years ago
Updated 14 May 2024, about 1 month ago

Problem

The ModuleInstaller service does not validate whether a module's requirements is fulfilled before it gets installed. Only drupal_check_module() validates it and it is currently only called by the ModuleListForm. Thanks for this implementation modules that has missing requirements could be enabled programmatically or any other way except from the Module list UI.
I highlighted the "or any other way" above because I bumped into this problem when we tried to prevent in our module that its deprecated sub-module could be enabled in new installations. We added a hook_requirements() to our module that worked perfectly on the UI but Drush completely ignored it. It did that because even if it calls the ModuleInstaller to install a module it does not call the drupal_check_module() function. https://github.com/drush-ops/drush/issues/3669
Also if you check what Drush has to do to enable a module you should see that it has to do quite some workaround to do that instead it could rely on Drupal's built-in API to handle installation of a module (or should I say component): https://github.com/drush-ops/drush/blob/9.7.0/src/Drupal/Commands/pm/PmC...

Proposed solution

1. Just like ModuleInstaller has uninstall validator now, add install validators as well to the service and what drupal_check_module() does at this moment should be a default install validator for modules.

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
ExtensionΒ  β†’

Last updated 3 days ago

No maintainer
Created by

πŸ‡­πŸ‡ΊHungary mxr576 Hungary

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.

Production build 0.69.0 2024