| [ Index ] |
|
Code source de PHP PEAR 1.4.5 |
[Code source] [Imprimer] [Statistiques]
PEAR_Config, customized configuration handling for the PEAR Installer PHP versions 4 and 5
| Author: | Stig Bakken <ssb@php.net> |
| Author: | Greg Beaver <cellog@php.net> |
| Copyright: | 1997-2006 The PHP Group |
| License: | http://www.php.net/license/3_0.txt PHP License 3.0 |
| Version: | CVS: $Id: Config.php,v 1.137 2006/11/19 21:33:00 cellog Exp $ |
| Poids: | 2108 lignes (69 kb) |
| Inclus ou requis: | 10 fois |
| Référencé: | 0 fois |
| Nécessite: | 6 fichiers PEAR/Remote.php PEAR/Registry.php PEAR/Installer/Role.php PEAR.php System.php PEAR/Common.php |
PEAR_Config:: (47 méthodes):
PEAR_Config()
singleton()
validConfiguration()
readConfigFile()
readFTPConfigFile()
_setupChannels()
deleteChannel()
mergeConfigFile()
arrayMergeRecursive()
writeConfigFile()
_readConfigDataFrom()
getConfFile()
_addConfigVars()
_encodeOutput()
_decodeInput()
getDefaultChannel()
get()
_getChannelValue()
set()
_lazyChannelSetup()
setChannels()
getType()
getDocs()
getPrompt()
getGroup()
getGroups()
getGroupKeys()
getSetValues()
getKeys()
remove()
removeLayer()
store()
toDefault()
definedBy()
isDefaulted()
isDefined()
isDefinedLayer()
getLayers()
apiVersion()
getRegistry()
setRegistry()
noRegistry()
getRemote()
getREST()
getFTP()
_prependPath()
setInstallRoot()
Classe: PEAR_Config - X-Ref
This is a class for storing configuration data, keeping track of| PEAR_Config($user_file = '', $system_file = '', $ftp_file = false,$strict = true) X-Ref |
| Constructor. param: string file to read user-defined options from param: string file to read system-wide defaults from param: bool determines whether a registry object "follows" param: bool if true, fails if configuration files cannot be loaded |
| singleton($user_file = '', $system_file = '', $strict = true) X-Ref |
| Static singleton method. If you want to keep only one instance of this class in use, this method will give you a reference to the last created PEAR_Config object if one exists, or create a new object. param: string (optional) file to read user-defined options from param: string (optional) file to read system-wide defaults from return: object an existing or new PEAR_Config instance |
| validConfiguration() X-Ref |
| Determine whether any configuration files have been detected, and whether a registry object can be retrieved from this configuration. return: bool |
| readConfigFile($file = null, $layer = 'user', $strict = true) X-Ref |
| Reads configuration data from a file. All existing values in the config layer are discarded and replaced with data from the file. param: string file to read from, if NULL or not specified, the param: string config layer to insert data into ('user' or 'system') return: bool TRUE on success or a PEAR error on failure |
| readFTPConfigFile($path) X-Ref |
param: string url to the remote config file, like ftp://www.example.com/pear/config.ini return: true|PEAR_Error |
| _setupChannels() X-Ref |
| Reads the existing configurations and creates the _channels array from it |
| deleteChannel($channel) X-Ref |
| Pas de description |
| mergeConfigFile($file, $override = true, $layer = 'user', $strict = true) X-Ref |
| Merges data into a config layer from a file. Does the same thing as readConfigFile, except it does not replace all existing values in the config layer. param: string file to read from param: bool whether to overwrite existing data (default TRUE) param: string config layer to insert data into ('user' or 'system') param: string if true, errors are returned if file opening fails return: bool TRUE on success or a PEAR error on failure |
| arrayMergeRecursive($arr2, $arr1) X-Ref |
param: array param: array return: array |
| writeConfigFile($file = null, $layer = 'user', $data = null) X-Ref |
| Writes data into a config layer from a file. param: string|null file to read from, or null for default param: string config layer to insert data into ('user' or param: string|null data to write to config file or null for internal data [DEPRECATED] return: bool TRUE on success or a PEAR error on failure |
| _readConfigDataFrom($file) X-Ref |
| Reads configuration data from a file and returns the parsed data in an array. param: string file to read from return: array configuration data or a PEAR error on failure |
| getConfFile($layer) X-Ref |
| Gets the file used for storing the config for a layer param: string $layer 'user' or 'system' |
| _addConfigVars($vars) X-Ref |
param: array information on a role as parsed from its xml file return: true|PEAR_Error |
| _encodeOutput(&$data) X-Ref |
| Encodes/scrambles configuration data before writing to files. Currently, 'password' values will be base64-encoded as to avoid that people spot cleartext passwords by accident. param: array (reference) array to encode values in return: bool TRUE on success |
| _decodeInput(&$data) X-Ref |
| Decodes/unscrambles configuration data after reading from files. param: array (reference) array to encode values in return: bool TRUE on success |
| getDefaultChannel($layer = null) X-Ref |
| Retrieve the default channel. On startup, channels are not initialized, so if the default channel is not pear.php.net, then initialize the config. param: string registry layer return: string|false |
| get($key, $layer = null, $channel = false) X-Ref |
| Returns a configuration value, prioritizing layers as per the layers property. param: string config key return: mixed the config value, or NULL if not found |
| _getChannelValue($key, $layer, $channel) X-Ref |
| Returns a channel-specific configuration value, prioritizing layers as per the layers property. param: string config key return: mixed the config value, or NULL if not found |
| set($key, $value, $layer = 'user', $channel = false) X-Ref |
| Set a config value in a specific layer (defaults to 'user'). Enforces the types defined in the configuration_info array. An integer config variable will be cast to int, and a set config variable will be validated against its legal values. param: string config key param: string config value param: string (optional) config layer param: string channel to set this value for, or null for global value return: bool TRUE on success, FALSE on failure |
| _lazyChannelSetup($uselayer = false) X-Ref |
| Pas de description |
| setChannels($channels, $merge = false) X-Ref |
| Set the list of channels. This should be set via a call to {@link PEAR_Registry::listChannels()} param: array param: bool return: bool success of operation |
| getType($key) X-Ref |
| Get the type of a config value. param: string config key return: string type, one of "string", "integer", "file", |
| getDocs($key) X-Ref |
| Get the documentation for a config value. param: string config key return: string documentation string |
| getPrompt($key) X-Ref |
| Get the short documentation for a config value. param: string config key return: string short documentation string |
| getGroup($key) X-Ref |
| Get the parameter group for a config key. param: string config key return: string parameter group |
| getGroups() X-Ref |
| Get the list of parameter groups. return: array list of parameter groups |
| getGroupKeys($group) X-Ref |
| Get the list of the parameters in a group. param: string $group parameter group return: array list of parameters in $group |
| getSetValues($key) X-Ref |
| Get the list of allowed set values for a config value. Returns NULL for config values that are not sets. param: string config key return: array enumerated array of set values, or NULL if the |
| getKeys() X-Ref |
| Get all the current config keys. return: array simple array of config keys |
| remove($key, $layer = 'user') X-Ref |
| Remove the a config key from a specific config layer. param: string config key param: string (optional) config layer return: bool TRUE on success, FALSE on failure |
| removeLayer($layer) X-Ref |
| Temporarily remove an entire config layer. USE WITH CARE! param: string config key param: string (optional) config layer return: bool TRUE on success, FALSE on failure |
| store($layer = 'user', $data = null) X-Ref |
| Stores configuration data in a layer. param: string config layer to store return: bool TRUE on success, or PEAR error on failure |
| toDefault($key) X-Ref |
| Unset the user-defined value of a config key, reverting the value to the system-defined one. param: string config key return: bool TRUE on success, FALSE on failure |
| definedBy($key, $returnchannel = false) X-Ref |
| Tells what config layer that gets to define a key. param: string config key param: boolean return the defining channel return: string|array the config layer, or an empty string if not found. |
| isDefaulted($key) X-Ref |
| Tells whether a config value has a system-defined value. param: string config key return: bool |
| isDefined($key) X-Ref |
| Tells whether a given key exists as a config value. param: string config key return: bool whether <config key> exists in this object |
| isDefinedLayer($layer) X-Ref |
| Tells whether a given config layer exists. param: string config layer return: bool whether <config layer> exists in this object |
| getLayers() X-Ref |
| Returns the layers defined (except the 'default' one) return: array of the defined layers |
| apiVersion() X-Ref |
| Pas de description |
| getRegistry($use = null) X-Ref |
return: PEAR_Registry |
| setRegistry(&$reg, $layer = 'user') X-Ref |
| This is to allow customization like the use of installroot param: PEAR_Registry return: bool |
| noRegistry() X-Ref |
| Pas de description |
| getRemote() X-Ref |
return: PEAR_Remote |
| getREST($version, $options = array() X-Ref |
return: PEAR_REST |
| getFTP() X-Ref |
| The ftp server is set in {@link readFTPConfigFile()}. It exists only if a remote configuration file has been specified return: PEAR_FTP|false |
| _prependPath($path, $prepend) X-Ref |
| Pas de description |
| setInstallRoot($root) X-Ref |
param: string|false installation directory to prepend to all _dir variables, or false to |
| Généré le : Sun Feb 25 14:08:00 2007 | par Balluche grâce à PHPXref 0.7 |