SwatObject
└─SiteObject
└─SiteApplication
└─SiteCommandLineApplication
└─SiteConfigChecker
public class SiteConfigChecker
extends SiteCommandLineApplication
| Fields inherited from Site.SiteCommandLineApplication | |
|---|---|
| VERBOSITY_ALL, VERBOSITY_ERRORS, VERBOSITY_NONE, arguments, documentation, lock_file, title, verbosity | |
| Fields inherited from Site.SiteApplication | |
|---|---|
| VAR_COOKIE, VAR_ENV, VAR_FILES, VAR_GET, VAR_POST, VAR_REQUEST, VAR_SERVER, VAR_SESSION, default_time_zone, id, locale, modules, modules_by_provides | |
| Constructor Summary | |
|---|---|
SiteConfigChecker(mixed id, mixed title, mixed documentation) |
|
| Method Summary | |
|---|---|
| void | addDefinition(string section, string name, string default_value) Adds a configuration setting definition to this config module. |
| void | addDefinitions(array definitions) Adds multiple configuration setting definitions to this config module. |
| private boolean | check() Checks an in file to ensure all the fields are defined. |
| private boolean | isValidKey(string name) Checks whether or not a name is a valid section name or setting name. |
| void | run() Run the application. |
| void | setFilename(mixed filename) |
| void | setQuiet(boolean quiet) Sets whether or not this application is quiet. |
| Methods inherited from Site.SiteCommandLineApplication | |
|---|---|
| addCommandLineArgument, debug, displayArgumentUsage, displayUsage, error, getLockFilename, getScriptDirectory, lock, output, parseCommandLineArguments, setApplicationDirectory, setVerbosity, terminate, unlock | |
| Methods inherited from Site.SiteApplication | |
|---|---|
| addConfigDefinitions, addDefaultModule, addDefaultModules, addModule, configure, configureErrorHandling, getCountry, getDefaultModuleList, getInstance, getInstanceId, getLocale, getModule, hasModule, initModules, initVar, postInitConfigure, run | |
public SiteConfigChecker(mixed id, mixed title, mixed documentation)
public void addDefinition(string section, string name, string default_value)
Adds a configuration setting definition to this config module
Only defined settings may be loaded from an ini file. Other settings will throw exceptions when they are loaded.
section - the section the setting belongs to.name - the name of the setting.default_value - optional. The default value of the setting. Used if the setting does exist in the loaded ini file.public void addDefinitions(array definitions)
Adds multiple configuration setting definitions to this config module
Only defined settings may be loaded from an ini file. Other settings will throw exceptions when they are loaded.
definitions - an associative array of setting definitions. The array is of the form: qualified_name => default_value where qualified_name is a string containing the section name and the setting name separated by a '.'. For example, a setting for 'dsn' in the 'database' section would have a qualified name of 'database.dsn'. The default value is a string containing the value to use for the setting if the setting does not exist in the loaded configuration file. Use null to specify no default.private boolean check()
Checks an in file to ensure all the fields are defined
private boolean isValidKey(string name)
Checks whether or not a name is a valid section name or setting name
name - the name to check.public void run()
Run the application.
public void setFilename(mixed filename)
public void setQuiet(boolean quiet)
Sets whether or not this application is quiet
quiet - optional. Whether or not this application is quiet. If not specified, defaults to true.
Command line application for checking if an ini file is valid
Because of the way the site configuration module parses ini properties into PHP properties, all ini settings names must be valid PHP variable names. Additionally, ini properties must be defined to be valid.