I found a strange issue during Drupal install where hook_requirements('install') is called on seemingly random modules. After looking into the code, it seems that the problem lies within the drupal_get_install_functions() function in includes/install.inc. The function is passed a list of required modules (the modules getting installed as part of the profile), for example node, user, block, etc. and then tries to find .install files for the modules using the following pattern: '/' . $module . '.install$/'. As the pattern reads, the install files for all modules whose name matches or ends with the names of the required modules get called. For example, hook_requirements('install') will get invoked on the modules "mymodule_node" and "mymodulenode" even if they aren't being installed simply because they end with the word "node". This very small patch alters the $mask parameter so that it exactly matches the list of required modules. As a side note, a similar issue exists in D5 and D6 as well, and it has bit some users of the Search Lucene API module because it has a bundled contrib that is named "luceneapi_node".
Thanks,
Chris
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | install-592182-3.patch | 471 bytes | cpliakas |
| #1 | hook-requirements-fix-01.patch | 446 bytes | cpliakas |
| hook-requirements-fix.patch | 424 bytes | cpliakas |
Comments
Comment #1
cpliakas commentedAmendment to the above post. I stated that the problem lies within the drupal_get_install_functions() function, but what I meant to type was drupal_get_install_files(). Also, I just noticed that drupal_get_install_files() gets called when a module is installed via the system modules form, so the bug is not limited Drupal installation as I first thought. I see that preg_match() has been used in place of ereg() in file_scan_directory(), so the revised patch makes use of preg_quote() function to properly escape the "." in the $mask parameter ensuring that it is an exact match.
Comment #3
cpliakas commentedRefreshed patch with HEAD.
Comment #5
mr.baileysdrupal_get_install_files()was seriously refactored in #358815: drupal_get_install_files() is slow with a large tree and as such this patch will need to be re-rolled (also, please make sure to submit the patches in unified diff format, see http://drupal.org/patch/create.)@cpliakas: can you verify that this issue still exists with current HEAD?
Comment #6
cpliakas commentedHi mr.baileys.
I looked over the patch at #358815: drupal_get_install_files() is slow with a large tree, and it seems to resolve this issue because the regex is replaced with an array of dependencies. I am closing this issue, because it is no longer an issue as of the 7.0-alpha3 release.
Thanks,
Chris
Comment #7
cpliakas commented