Order of drupal_check_module() calls should respect module dependencies.

Created on 10 February 2014, about 11 years ago
Updated 11 March 2025, about 2 months ago

drupal_check_module() invokes hook_requirements on a specific module, to determine whether it can be safely enabled.

drupal_check_module() is called from
- ModulesListForm::buildModuleList (Drupal 8)
- drush_pm_enable_validate() (drush)
- system_modules_submit() (Drupal 7)
- features_form_validate() (Features in Drupal 7 contrib)

Scenario (Drupal 7):
- views_content_ds depends on xautoload.
- Let's assume both of these modules implement hook_requirements().
- Both modules are disabled.
- I run drush en views_content_ds, which would trigger enabling of both modules.

Observed result:
- views_content_ds_requirements() runs before xautoload_requirements().

This is unfortunate, because I would like to do some feature detection in views_content_ds, which only works if xautoload has a chance to run its own hook_requirements() beforehand.

Proposed solution:
- run drupal_check_module() checks in an order that respects module dependencies.
- factor this order management out of form submit handlers, into a separate, reusable function or class.

(The scenario I describe may be very specific, but I think it would still be generally useful)

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

base system

Created by

πŸ‡©πŸ‡ͺGermany donquixote

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

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 smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024