WL#3295: plugin run-time dependencies

Affects: Prototype Only   —   Status: Un-Assigned   —   Priority: Low

We need to support some sort of dependencies for plugins.
E.g. "plugin XXX must be started before plugin YYY", or "plugin YYY requires
plugin ZZZ to be running".

It's not clear yet how to specify them, especially if plugins are both loaded
dynamically, from different shared objects, and generally written by different
people, downloaded and installed independently.

could be something like (pseudo-code):
 dependencies = {
    needs = {{"plugin11" soname, version}, {plugin12, soname, version}, ...},
            {{"plugin21" soname, version}, {plugin22, soname, version}, ...},
    before = "plugin3", "plugin4", ...
    after = "plugin5", "plugin6", ...

the "needs" dependency specifies what plugins this plugin needs, they will be
auto-installed if necessary (perhaps, a server variable or INSTALL option will
disable auto-installing). Needed plugins are specified in groups - one plugin in
a group will be loaded, that is the above example means that the plugin need

   (plugin11 OR plugin12) AND (plugin21 OR plugin 22)

Perhaps "version" should be a range of versions.

before and after dependencies specify the loading order.


In PHP land this is done by adding a pointer to an array of zend_module_dep
entries to the zend_module_entry structure describing an extension:

  static zend_module_dep crossext_deps[] = {
          ZEND_MOD_REQUIRED_EX("standard", "eq", "3.14")
          {NULL, NULL, NULL, 0} 

  zend_module_entry crossext_module_entry = {

PHP provides a set of convenience macros to populate the
dependencies array:


The _ex (for *extended') allow the additional specification
of version dependencies which are ignored so far though.

On startup the dependencies for all extensions compiled in
or loaded via the php.ini configuration file are checked
for conflicts and then ordered so that the extensions MINIT()
and MSHUTDOWN() handlers can be called in proper sequence.

For extensions not loaded on startup but at runtime using
the dl() function the dependency sorting obviously doesn't
work, here only the dependency checking is done and the
load request is rejected if dependencies are not fullfilled
or conflicts are detected, but doing things in the right order
now lies on the application level.

-- hartmut