hook_requirements('install') doesn't work for contrib
mooffie - September 24, 2008 - 11:01
| Project: | Drupal |
| Version: | 5.x-dev |
| Component: | install system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
We need to document the fact that hook_requirements('install') doesn't work for modules that don't reside in the main './modules' folder. In other words, that this hook works only for core modules. And since new core modules aren't written for Drupal 5 anymore, it's best to simply remove any mention of hook_requirements('install') from the documentation.
The reason hook_requirements('install') only work for modules residing in './modules' is because the module is loaded via drupal_get_install_files(), which does file_scan_directory('./modules', ...).
[The problem is specific to Drupal 5. It doens't exist in Drupal 6.]

#1
That's a plain bug, not just a documentation bug.
#2
Here is a patch for this.
Note: the require_once(common.inc) is absolutely required. It only works without this on D6 because _drupal_maintenance_theme loads it itself...
#3
I can confirm that the patch works.
Damien, thanks.
I admit that the thought "we should fix this" has never crossed my mind. I imagined months upon months of deliberations. You are very optimistic, Damien.
#4
CNR: to give it the needed extra attention,
#5
Since @moofie confirms that the patch works let's say so.
#6
Committed to 5.x.
#7
ah, this was a duplicate of: #110981: Contrib module's hook_requirements are not called when installing
#8
Automatically closed -- issue fixed for two weeks with no activity.