Well, I appreciate someone is finally thinking about dependencies. I had a look at Nedjo's code, here are some questions: 0) Do you handle module versions? I don't see anything in the code. How do i say, "I depend on moduleA versions > 10, but not more than 15" 1) How is an upgrade handled? Say module A required module B on install. Does it again require it during upgrade, or can the module be missing? (think "import" modules vs "actual" modules) 2) The code auto-disables stuff; which is dangerous. I would provide an additional disable hook for the faulty module to recover from problems before being killed. Say we had a spam-clean.module, depending on search.module for finding to clean nodes. Now an admin accidentally disables search.module because spam bots are wreaking havoc, and this disables spam-clean, which foobars the website. A good place to look for inspiration is APT, instead of reinventing the wheel. http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html (I think i've mentioned this before when the topic came up) -Arnab On 4/8/06, Nedjo Rogers <nedjo@islandnet.com> wrote:
* Dependencies are an issue for some of the stuff I'm installing. It would be a good thing if the .install could detect that a needed module was not present, and in that case, put up an error message and refuse to install. Is there a mechanism to do this currently?
Based on code Chad (hunmunk) posted, I've drafted a Dependencies module, http://drupal.org/node/57071, that tests for dependencies and doesn't allow modules to be installed if their dependencies are missing. You could include a _dependencies() hook, e.g.
modulename_dependencies() { return array('module1', 'module2'); }
Of course, that will work only if a site has the Dependencies module installed and enabled.
Or else feel free to just add your dependencies to the default array in the dependencies/dependencies.module (this goes for any other module developer).
Robert Douglass suggested, and I concur, that it woud be useful to distinguish between hard and soft dependencies, but I haven't yet incorporated his suggestion into the module.
Nedjo