Unified MidCOM configuration system

MidCOM configuration was always a more or less undefined process, leading to rather clumpsy initialization code in several places of MidCOM. With MidCOM 2.4 a new structured and centralized configuration mechanismn has been put in place.

For me, as a developer, the main goal for this new MidCOM setup code is the ability to more easily control defaults and the configuration merging process. Especially, there are now a couple of more variables with sensible defaults which further simplify the configuration of a MidCOM site.

Full documentation over all available configuration options and the basic configuration process can be found in the file midcom_config.php in the CVS Head API documentation.

Guidelines for site maintainers

MidCOM configuration can now be affected by the global acciociative array midcom_config_local, which is merged with the default MidCOM configuration set in midcom_config.php. Both keys and values are defined in the documentation referenced above. The example code at the bottom of this page shows how MidCOM should be initialized now. Note, that by the time you initialize the configuration array, the MidCOM constants are not yet available. Therefore you'll have to set their explicit values. Currently, this only applies to the log levels.

At this time, there is no "site-local" MidCOM configuration available, all settings have to be made on a per-site level right now. I have planned to solve this problem before MidCOM 2.4 goes out though, having some configuration in /etc which is merged into the MidCOM defaults before applying the site-local config.

As usual, with MidCOM core files, you should never touch the defaults in midcom_config.php.

Guidelines for MidCOM developers

MidCOM makes the system configuration available in the global acciociative array midcom_config, which should not be written to under any circumstances. (At least, not unless I allow you to *scnr*.)

When writing templates for MidCOM, you should only set those variables the user explicitly changes away from a "system default" setting, leaving all other values to where the system set them, to allow for easy migration to new default settings when upgrading.

Another new point to honor is that all external utility locations are now placed into the midcom configuration using keys prefixed with utility. All utilities currently available through the configuration can be found in the documentation of midcom_config.php. New utilities should be added there, as well as in the autoconf.php and config-test.php scripts to ensure proper operations. If in doubt, contact me how to do this.



= Array();

$config['midcom_root_topic_guid'] = "860f1b5af98b409abd916a80cdb0d68e";
$config['cache_base_directory'] = '/var/cache/midcom/';
$config['log_filename'] = '/var/log/midcom/mysite.log';
$config['log_level'] = 2;

$GLOBALS['midcom_config_local'] = $config;