Problem/Motivation

For https://www.drupal.org/node/592800 reported similar problem, that is a child (dependent) module has hook_requirements() and it returns with error status. This case patches are already included Drupal Core System module.

Besides 592800, I also found dependent module is also installed when a parent (current) module has hook_requirements() returns with error status for 'install' phase.

I tested both cases and this problem only happens through UI case. When I tested enable module with drush, dependent module is not installed.

Proposed resolution

system_rebuild_module_data() function returns two lists of dependents modules. One is 'requires' which is a module's dependent modules list. The other is 'required_by' which is current module is a dependent module of other module. Current Drupal system module is include 'required_by' module list to set to enable 'FALSE' .

foreach (array_keys($files[$name]->required_by) as $required_by) {
    $modules[$required_by]['enabled'] = FALSE;
 }

I believe that we need additional module list, 'requires' to set to enable 'FALSE' as like,

foreach (array_keys($files[$name]->requires) as $requires) {
  $modules[$requires]['enabled'] = FALSE;
}

Steps to reproduce problem

  1. Create a dummy test module that include at least one dependent module, that is never enabled by other module, include this dependent module into .info file
  2. Also, create a .install file to include hook_requirements($phase) when a $phase value has 'install', returns with error status.
  3. go to module list page, enable the dummy module that you created

Since hook_requirements() returns with 'error' status, dependent module should not enabled. You may check the dependent module enabling status from dummy module's requires list from admin module list page.

Remaining tasks

patches will be available soon

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cyslee created an issue. See original summary.

cyslee’s picture

cyslee’s picture

Issue summary: View changes
cyslee’s picture

Status: Active » Needs review

Status: Needs review » Needs work

Status: Needs work » Needs review
cyslee’s picture

Issue summary: View changes

Status: Needs review » Needs work
cyslee’s picture

FileSize
910 bytes
cyslee’s picture

Status: Needs work » Needs review
Elijah Lynn’s picture

Status: Needs review » Needs work

Need steps to reproduce.

cyslee’s picture

Version: 7.38 » 7.39
Issue summary: View changes
cyslee’s picture

Status: Needs work » Needs review
cyslee’s picture

Issue summary: View changes
bleen’s picture

Two questions:

  1. Is this an issue in D8? If so, then it needs to be fixed there first.
  2. Can we include a simpletest for this? The related issue had tests that this issue could probably piggyback off of.
cyslee’s picture

FileSize
5.04 KB

@bleen18: I post a new patch that include simpletest test case and fixes. Also when I test D8, for this case, D8 displays the requirements error message on required module install question page. If a user wants to install required module continuously even if see the requirement error message, the dependent module(s) will be enabled it.
I haven't test D8 drush yet.

drupalnesia’s picture

Version: 7.39 » 7.41

This bug still happen on Drupal 7.41, but only on ($phase == 'install'), while ($phase == 'runtime') run well.

sachin00700’s picture

Fixed

Version: 7.41 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.