PostNuke: A Flexible Open Source Content Management System
home | forum | international support | contact us

Documentation Wiki

Module dependencies


Introduction to Module Dependencies


As the overall modularity of PostNuke increases and the modules architecture moves away from large, monolithic modules to smaller, leaner single purpose modules it becomes necessary to provide a means by which site administrators can be informed of any dependencies for modules which they might add to or remove from a site.

PostNuke 0.80 introduces a simple but effective dependencies system that performs two main tasks

  1. Before a module is initialized a list of modules upon which this module depends will be presented to the user. The module cannot be initialized if any required dependencies are not met.
  2. Before a module is removed a list of modules which are dependent on this module will be presented to the user. The module cannot be removed prior to removal of any dependent modules.

The system provides three levels of dependencies

  1. PNMODULE_DEPENDENCY_REQUIRED - a required dependency. This module will not function without its dependency.
  2. PNMODULE_DEPENDENCY_RECOMMENDED - a recommended dependency. While this module will function without its dependency it's recommend that this dependency is also available.
  3. PNMODULE_DEPENDENCY_CONFLICTS - a conflicting module. This module conflicts with another already present in the system. It's unlikely that this dependency level will ever be used but is present for completeness.

Module dependencies are stored in a single database table <table_prefix>_module_dependencies. This table is populated when the regenerate modules function is activated. At each regeneration of the modules list the dependencies table is emptied and repopulated.

Defining a Module Dependency


Module dependencies are defined via an additional field, $modversion['dependencies'], in the module version file - pnversion.php. The additional field is a array of dependencies. Each dependency itself is an array containing the module name, minimum and maximum versions and the type of dependency.

A sample dependency can be seen in the PostNuke 0.80 system package with the Categories module which is dependent on the ObjectData? module. The dependencies entry in the version file looks like

    $modversion['dependencies'] = array(array('modname'    => 'ObjectData',
                                              'minversion' => '1.0',
                                              'maxversion' => '',
                                              'status'     => PNMODULE_DEPENDENCY_REQUIRED
                                              ));

This dependency indicates that the Categories module is dependent on any version of the ObjectData? data module after v1.0 and that it's required for the Categories module to operate.



CategoryDeveloperDocs
XML Revisions of $tag
Page history :: Last Editor [ bmichel ] :: Owner [ markwest ] ::
Valid XHTML :: Valid CSS :: Powered by pnWikka 1.0 (A wiki fork from WikkaWiki)
 

Main Menu

Extensions Database

Documentation

Development

Login





 


 Log in Problems?
 New User? Sign Up!

Donate to PostNuke