[development] Installation -- Can A Module "Refuse" To Be Installed?

Nedjo Rogers nedjo at islandnet.com
Sun Apr 9 01:01:06 UTC 2006


>    * 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 



More information about the development mailing list