Administration Module
Configuration Data
The configuration data change page (Administration → Config Values) now includes type and range checking. Earlier all values had to be entered as text and configuration could have been messed by entering invalid values.
The new type and range checking feature uses meta data about the configuration values to restrict the type and range of values that can be entered by the user.
Each configuration file (including sysconf.inc and other configuration files in the modules) needs to have a corresponding metadata file which has the name <conf_file>_meta.inc (sysconf_meta.inc for sysconf.inc).
A sample of this file is shown below.
<?php /** * The main Sahana configuration meta data file * * PHP version 4 and 5 * * LICENSE: This source file is subject to LGPL license * that is available through the world-wide-web at the following URI: * http://www.gnu.org/copyleft/lesser.html * * @package Sahana - http://sahana.sourceforge.net * @author Ravith Botejue <ravithb@yahoo.com> * @copyright Lanka Software Foundation - http://www.opensource.lk */ ###################################################################### # Sahana Main Configuration Settings Meta data # ###################################################################### # # $conf_meta['base_uuid'] = array('type'=>'string','size'=>-1,'allow_null'=>true,'default_value'=>'saha'); # Disable the access control system $conf_meta['acl_base'] = array('type'=>'boolean','default_value'=>false); # Root Name :The owner of the machine $conf_meta['root_name'] = array('type'=>'string','size'=>-1,'allow_null'=>true,'default_value'=>''); # Root Email :The email address of the admin $conf_meta['root_email'] = array('type'=>'email','size'=>-1,'allow_null'=>true,'default_value'=>'root@localhost'); # Root Telephone :The telephone of the admin $conf_meta['root_tel'] = array('type'=>'string','size'=>-1,'allow_null'=>true,'default_value'=>''); # port that data base talks. leave blank for default. # $conf_meta['db_port'] = array('type'=>'integer','min_value'=>1024,'max_value'=>65535,'allow_null'=>false,'default_value'=>'3306'); $conf_meta['db_pass'] = array('type'=>'password','min_size'=>0,'max_size'=>0,'allow_null'=>true,'default_value'=>''); $conf_meta['debug'] = array('type'=>'boolean','default_value'=>false);
The current variable types are
- string
- email
- integer
- double
- password
- boolean
The todo variable types are
- url
- options list
Each variable type has the following properties.
Type : string | |
---|---|
size | The length of the string |
allow_null | Whether to allow null values |
default_value | The default value |
Type : email | |
allow_null | Whether to allow null values |
default_value | The default value |
Type : integer | |
min_value | The minimum value possible |
max_value | The maximum value possible |
allow_null | Whether to allow null values |
default_value | The default value |
Type : double | |
min_value | The minimum value possible |
max_value | The maximum value possible |
allow_null | Whether to allow null values |
precision | The precision of the value expected |
default_value | The default value |
Type : password | |
min_size | The minimum password length |
max_size | The maximum password length |
allow_null | Whether to allow null values |
Type : boolean | |
default_value | The default value |
If <conf_file>_meta.inc is not found along with the respective configuration file, the user will be prompted for a string value (as in the earlier version) and no validations will be performed.
Below are some screenshots of validations in action.