Public Member Functions | |
| get ($settingName, $wiki, $suffix=null, $params=array(), $wikiTags=array()) | |
| Retrieves a configuration setting for a given wiki. | |
| doReplace ($from, $to, $in) | |
| Type-safe string replace; won't do replacements on non-strings private? | |
| getAll ($wiki, $suffix=null, $params=array(), $wikiTags=array()) | |
| Gets all settings for a wiki. | |
| getBool ($setting, $wiki, $suffix=null, $wikiTags=array()) | |
| Retrieves a configuration setting for a given wiki, forced to a boolean. | |
| & | getLocalDatabases () |
| Retrieves an array of local databases. | |
| initialise () | |
| A no-op. | |
| extractVar ($setting, $wiki, $suffix, &$var, $params=array(), $wikiTags=array()) | |
| Retrieves the value of a given setting, and places it in a variable passed by reference. | |
| extractGlobal ($setting, $wiki, $suffix=null, $params=array(), $wikiTags=array()) | |
| Retrieves the value of a given setting, and places it in its corresponding global variable. | |
| extractGlobalSetting ($setting, $wiki, $params) | |
| extractAllGlobals ($wiki, $suffix=null, $params=array(), $wikiTags=array()) | |
| Retrieves the values of all settings, and places them in their corresponding global variables. | |
| siteFromDB ($db) | |
| Work out the site and language name from a database name. | |
| isLocalVHost ($vhost) | |
| Returns true if the given vhost is handled locally. | |
Static Public Member Functions | |
| static | arrayMerge ($array1) |
| Merge multiple arrays together. | |
Public Attributes | |
| $suffixes = array() | |
| Array of suffixes, for self::siteFromDB(). | |
| $wikis = array() | |
| Array of wikis, should be the same as $wgLocalDatabases. | |
| $settings = array() | |
| The whole array of settings. | |
| $localVHosts = array() | |
| Array of domains that are local and can be handled by the same server. | |
| $siteParamsCallback = null | |
A callback function that returns an array with the following keys (all optional):
| |
Protected Member Functions | |
| getSetting ($settingName, $wiki, $params) | |
| Really retrieves a configuration setting for a given wiki. | |
| getWikiParams ($wiki) | |
| Return specific settings for $wiki See the documentation of self::$siteParamsCallback for more in-depth documentation about this function. | |
| mergeParams ($wiki, $suffix, $params, $wikiTags) | |
| Merge params beetween the ones passed to the function and the ones given by self::$siteParamsCallback for backward compatibility Values returned by self::getWikiParams() have the priority. | |
We use DIY C-style protection as a workaround. This is a class used to hold configuration settings, particularly for multi-wiki sites.
Definition at line 18 of file SiteConfiguration.php.
| static SiteConfiguration::arrayMerge | ( | $ | array1 | ) | [static] |
Merge multiple arrays together.
On encountering duplicate keys, merge the two, but ONLY if they're arrays. PHP's array_merge_recursive() merges ANY duplicate values into arrays, which is not fun
Definition at line 373 of file SiteConfiguration.php.
References $i, $key, and $out.
Referenced by extractGlobalSetting(), getAll(), and getSetting().
| SiteConfiguration::doReplace | ( | $ | from, | |
| $ | to, | |||
| $ | in | |||
| ) |
Type-safe string replace; won't do replacements on non-strings private?
Definition at line 145 of file SiteConfiguration.php.
Referenced by getSetting().
| SiteConfiguration::extractAllGlobals | ( | $ | wiki, | |
| $ | suffix = null, |
|||
| $ | params = array(), |
|||
| $ | wikiTags = array() | |||
| ) |
Retrieves the values of all settings, and places them in their corresponding global variables.
| $wiki | String Wiki ID of the wiki in question. | |
| $suffix | String The suffix of the wiki in question. | |
| $params | Array List of parameters. $.'key' is replaced by $value in all returned data. | |
| $wikiTags | Array The tags assigned to the wiki. |
Definition at line 261 of file SiteConfiguration.php.
References $suffix, extractGlobalSetting(), and mergeParams().
| SiteConfiguration::extractGlobal | ( | $ | setting, | |
| $ | wiki, | |||
| $ | suffix = null, |
|||
| $ | params = array(), |
|||
| $ | wikiTags = array() | |||
| ) |
Retrieves the value of a given setting, and places it in its corresponding global variable.
| $settingName | String ID of the setting name to retrieve | |
| $wiki | String Wiki ID of the wiki in question. | |
| $suffix | String The suffix of the wiki in question. | |
| $params | Array List of parameters. $.'key' is replaced by $value in all returned data. | |
| $wikiTags | Array The tags assigned to the wiki. |
Definition at line 233 of file SiteConfiguration.php.
References $suffix, extractGlobalSetting(), and mergeParams().
| SiteConfiguration::extractGlobalSetting | ( | $ | setting, | |
| $ | wiki, | |||
| $ | params | |||
| ) |
Definition at line 238 of file SiteConfiguration.php.
References $GLOBALS, arrayMerge(), and getSetting().
Referenced by extractAllGlobals(), and extractGlobal().
| SiteConfiguration::extractVar | ( | $ | setting, | |
| $ | wiki, | |||
| $ | suffix, | |||
| &$ | var, | |||
| $ | params = array(), |
|||
| $ | wikiTags = array() | |||
| ) |
Retrieves the value of a given setting, and places it in a variable passed by reference.
| $settingName | String ID of the setting name to retrieve | |
| $wiki | String Wiki ID of the wiki in question. | |
| $suffix | String The suffix of the wiki in question. | |
| $var | Reference The variable to insert the value into. | |
| $params | Array List of parameters. $.'key' is replaced by $value in all returned data. | |
| $wikiTags | Array The tags assigned to the wiki. |
Definition at line 218 of file SiteConfiguration.php.
References $suffix.
| SiteConfiguration::get | ( | $ | settingName, | |
| $ | wiki, | |||
| $ | suffix = null, |
|||
| $ | params = array(), |
|||
| $ | wikiTags = array() | |||
| ) |
Retrieves a configuration setting for a given wiki.
| $settingName | String ID of the setting name to retrieve | |
| $wiki | String Wiki ID of the wiki in question. | |
| $suffix | String The suffix of the wiki in question. | |
| $params | Array List of parameters. $.'key' is replaced by $value in all returned data. | |
| $wikiTags | Array The tags assigned to the wiki. |
Definition at line 63 of file SiteConfiguration.php.
References $suffix, getSetting(), and mergeParams().
| SiteConfiguration::getAll | ( | $ | wiki, | |
| $ | suffix = null, |
|||
| $ | params = array(), |
|||
| $ | wikiTags = array() | |||
| ) |
Gets all settings for a wiki.
| $wiki | String Wiki ID of the wiki in question. | |
| $suffix | String The suffix of the wiki in question. | |
| $params | Array List of parameters. $.'key' is replaced by $value in all returned data. | |
| $wikiTags | Array The tags assigned to the wiki. |
Definition at line 166 of file SiteConfiguration.php.
References $GLOBALS, $suffix, arrayMerge(), getSetting(), and mergeParams().
| SiteConfiguration::getBool | ( | $ | setting, | |
| $ | wiki, | |||
| $ | suffix = null, |
|||
| $ | wikiTags = array() | |||
| ) |
Retrieves a configuration setting for a given wiki, forced to a boolean.
| $settingName | String ID of the setting name to retrieve | |
| $wiki | String Wiki ID of the wiki in question. | |
| $suffix | String The suffix of the wiki in question. | |
| $params | Array List of parameters. $.'key' is replaced by $value in all returned data. | |
| $wikiTags | Array The tags assigned to the wiki. |
Definition at line 196 of file SiteConfiguration.php.
References $suffix.
| & SiteConfiguration::getLocalDatabases | ( | ) |
| SiteConfiguration::getSetting | ( | $ | settingName, | |
| $ | wiki, | |||
| $ | params | |||
| ) | [protected] |
Really retrieves a configuration setting for a given wiki.
| $settingName | String ID of the setting name to retrieve. | |
| $wiki | String Wiki ID of the wiki in question. | |
| $params | Array: array of parameters. |
Definition at line 76 of file SiteConfiguration.php.
References $key, $suffix, arrayMerge(), and doReplace().
Referenced by extractGlobalSetting(), get(), and getAll().
| SiteConfiguration::getWikiParams | ( | $ | wiki | ) | [protected] |
Return specific settings for $wiki See the documentation of self::$siteParamsCallback for more in-depth documentation about this function.
| $wiki | String |
Definition at line 276 of file SiteConfiguration.php.
References $name.
Referenced by mergeParams(), and siteFromDB().
| SiteConfiguration::initialise | ( | ) |
| SiteConfiguration::isLocalVHost | ( | $ | vhost | ) |
Returns true if the given vhost is handled locally.
| $vhost | String |
Definition at line 363 of file SiteConfiguration.php.
| SiteConfiguration::mergeParams | ( | $ | wiki, | |
| $ | suffix, | |||
| $ | params, | |||
| $ | wikiTags | |||
| ) | [protected] |
Merge params beetween the ones passed to the function and the ones given by self::$siteParamsCallback for backward compatibility Values returned by self::getWikiParams() have the priority.
| $wiki | String Wiki ID of the wiki in question. | |
| $suffix | String The suffix of the wiki in question. | |
| $params | Array List of parameters. $.'key' is replaced by $value in all returned data. | |
| $wikiTags | Array The tags assigned to the wiki. |
Definition at line 312 of file SiteConfiguration.php.
References $suffix, and getWikiParams().
Referenced by extractAllGlobals(), extractGlobal(), get(), and getAll().
| SiteConfiguration::siteFromDB | ( | $ | db | ) |
Work out the site and language name from a database name.
| $db |
Definition at line 335 of file SiteConfiguration.php.
References $db, $suffix, and getWikiParams().
| SiteConfiguration::$localVHosts = array() |
Array of domains that are local and can be handled by the same server.
Definition at line 38 of file SiteConfiguration.php.
| SiteConfiguration::$settings = array() |
| SiteConfiguration::$siteParamsCallback = null |
A callback function that returns an array with the following keys (all optional):
if suffix and lang are passed they will be used for the return value of self::siteFromDB() and self::$suffixes will be ignored
Definition at line 52 of file SiteConfiguration.php.
| SiteConfiguration::$suffixes = array() |
| SiteConfiguration::$wikis = array() |
Array of wikis, should be the same as $wgLocalDatabases.
Definition at line 28 of file SiteConfiguration.php.
1.5.9