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.]
Comments
Comment #1
damien tournoud commentedThat's a plain bug, not just a documentation bug.
Comment #2
damien tournoud commentedHere 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...
Comment #3
mooffie commentedI 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.
Comment #4
maartenvg commentedCNR: to give it the needed extra attention,
Comment #5
earnie@drupal.org commentedSince @moofie confirms that the patch works let's say so.
Comment #6
drummCommitted to 5.x.
Comment #7
drewish commentedah, this was a duplicate of: #110981: Contrib module's hook_requirements are not called when installing