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
- 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
- Also, create a .install file to include hook_requirements($phase) when a $phase value has 'install', returns with error status.
- 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
Comment | File | Size | Author |
---|---|---|---|
#16 | 2558235-system-2.patch | 5.04 KB | cyslee |
#9 | 2558235-system-1.patch | 910 bytes | cyslee |
Comments
Comment #2
cyslee CreditAttribution: cyslee commentedComment #3
cyslee CreditAttribution: cyslee commentedComment #4
cyslee CreditAttribution: cyslee commentedComment #7
cyslee CreditAttribution: cyslee commentedComment #9
cyslee CreditAttribution: cyslee commentedComment #10
cyslee CreditAttribution: cyslee commentedComment #11
Elijah LynnNeed steps to reproduce.
Comment #12
cyslee CreditAttribution: cyslee commentedComment #13
cyslee CreditAttribution: cyslee commentedComment #14
cyslee CreditAttribution: cyslee commentedComment #15
bleen CreditAttribution: bleen commentedTwo questions:
Comment #16
cyslee CreditAttribution: cyslee commented@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.
Comment #17
drupalnesia CreditAttribution: drupalnesia commentedThis bug still happen on Drupal 7.41, but only on ($phase == 'install'), while ($phase == 'runtime') run well.
Comment #18
sachin00700 CreditAttribution: sachin00700 as a volunteer and commentedFixed