feel free to keep it strictly simple...

precheck.php

How to use the precheck.php

The module file precheck.php allows you to define pre-installation checks for your module. (Check the required LEPTON- or PHP-Version, for example.) To do this, create a file named precheck.php in your module directory (like install.php and uninstall.php) and define an array called $PRECHECK. The following array keys are recognized:

LEPTON_VERSION

Required LEPTON-Version.

Code example:

 $PRECHECK['LEPTON_VERSION'] = array('VERSION' => '1.0', 'OPERATOR' => '>=');

The attribute OPERATOR may be omitted; default is '>=', which means 'bigger or equal'.

 

PHP_VERSION

Required PHP-Version.

Code example:

 $PRECHECK['PHP_VERSION'] = array('VERSION' => '5.2.6', 'OPERATOR' => '>=');

The attribute OPERATOR can be omitted. Default is '>='.

PHP_EXTENSIONS

Required PHP extensions. Expects an array with the extension names.

Code example:

 $PRECHECK['PHP_EXTENSIONS'] = array('gd', 'libxml');

PHP_SETTINGS

php.ini settings required. Expects an array; keys are the attributes as defined in the php.ini, values are the required settings.

Code example:

 $PRECHECK['PHP_SETTINGS'] = array('display_errors' => '1', 'safe_mode' => '0');

CUSTOM_CHECKS

If you need any additional checks, you may define CUSTOM_CHECKS. The values can be encountered programmatically (check if a special sub folder exists or something).

The following code example checks if template "blank" is installed:

 $status = file_exists(LEPTON_PATH . '/templates/blank/info.php');
 $required = $TEXT['INSTALLED'];
 $actual = ($status) ? $TEXT['INSTALLED'] : $TEXT['NOT_INSTALLED'];
 $PRECHECK['CUSTOM_CHECKS'] = array(
   'Template: blank'    => array('REQUIRED' => $required, 'ACTUAL' => $actual, 'STATUS'    => $status)
 );


NOTICE: the file precheck.php must be located in the root of the module directory to be executed automatically.