Posted by greg.harvey on January 27, 2009 at 6:28pm
Jump to:
| Project: | Drupal core |
| Version: | 6.x-dev |
| Component: | install system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
If your module's hook_install calls functions in modules, even if they are marked as dependencies, installation can fail with a WSOD due to missing functions. You can get around this with a hook_requirements (see this post for details: http://www.drupaler.co.uk/blog/using-hookrequirements-drupal-6x/135) but it would be far better if Drupal installed the dependencies as a batch and then invoked install.php *again* to install the initially requested module. This would be far safer behaviour. =)
Comments
#1
Having to use hook_requirements() to check dependencies is a faff. It's also a violation of DRY. Once a dependency is set in the .info file, it should be possible to trust that Drupal enforces this and not need to check for the existence of it ever again (unless you have weird requirements like specific versions). I'd call this a bug.
#2
subscribe. I am trying to create a CCK content type programmatically in my module at install, but this fails if several CCK modules are not installed even if they're listed as dependencies.
I agree with the bug categorization: the reasonable expectation is that a dependency will be available to a dependent module before any of its code runs. Thanks for the workaround, Greg.Harvey.
#3
Can you still reproduce this with latest HEAD? There were quite a few changes how dependencies are handled when installing modules.
#4
I guess that falls to me - I'll need to port the code in that blog post to Drupal 7 and report back.
#5
In Drupal 7, this doesn't seem to be an issue when installing a module on an existing site. However, I can reproduce the problem when installing Drupal itself; I think the modules are installed in the order they are listed in the install profile's .info file, regardless of any dependencies. So things can break unless the profile author makes sure to list the modules in a special order.
I thought there was another issue for this somewhere, but can't find it at the moment (#731944: Module dependencies not considered during Installation Profile installation may be related).
#6
Thanks for the update. Unassigning myself... =)
#7
I had the same problem.
Looks like dependencies don't count in relation to modules install order.
My solution was to move the code to hook_enable().
I realize that this is not a solution, but hope this can help others.
#8
I think the remaining issues here were fixed with #833192: Installer might install modules in wrong order - please feel free to reopen if not.
#9
Yay! That rocks! =)
#10
This issue originally for D6. Hoping for a patch backport in http://drupal.org/node/833192.