|
MediaWiki
REL1_19
|
This is a class used to hold configuration settings, particularly for multi-wiki sites. More...
Public Member Functions | |
| doReplace ($from, $to, $in) | |
| Type-safe string replace; won't do replacements on non-strings private? | |
| extractAllGlobals ($wiki, $suffix=null, $params=array(), $wikiTags=array()) | |
| Retrieves the values of all settings, and places them in their corresponding global variables. | |
| 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) | |
| 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. | |
| get ($settingName, $wiki, $suffix=null, $params=array(), $wikiTags=array()) | |
| Retrieves a configuration setting for a given wiki. | |
| 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. | |
| isLocalVHost ($vhost) | |
| Returns true if the given vhost is handled locally. | |
| loadFullData () | |
| siteFromDB ($db) | |
| Work out the site and language name from a database name. | |
Static Public Member Functions | |
| static | arrayMerge ($array1) |
| Merge multiple arrays together. | |
Public Attributes | |
| $fullLoadCallback = null | |
| Optional callback to load full configuration data. | |
| $fullLoadDone = false | |
| Whether or not all data has been loaded. | |
| $localVHosts = array() | |
| Array of domains that are local and can be handled by the same server. | |
| $settings = array() | |
| The whole array of settings. | |
| $siteParamsCallback = null | |
| A callback function that returns an array with the following keys (all optional): | |
| $suffixes = array() | |
| Array of suffixes, for self::siteFromDB() | |
| $wikis = array() | |
| Array of wikis, should be the same as $wgLocalDatabases. | |
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 between the ones passed to the function and the ones given by self::$siteParamsCallback for backward compatibility Values returned by self::getWikiParams() have the priority. | |
This is a class used to hold configuration settings, particularly for multi-wiki sites.
Definition at line 5 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
| $array1 | array |
Definition at line 385 of file SiteConfiguration.php.
References $out.
Referenced by extractGlobalSetting(), getAll(), and getSetting().

| SiteConfiguration::doReplace | ( | $ | from, |
| $ | to, | ||
| $ | in | ||
| ) |
Type-safe string replace; won't do replacements on non-strings private?
| $from | |
| $to | |
| $in |
Definition at line 145 of file SiteConfiguration.php.
References $in.
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 265 of file SiteConfiguration.php.
References 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.
| $setting | 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 232 of file SiteConfiguration.php.
References extractGlobalSetting(), and mergeParams().

| SiteConfiguration::extractGlobalSetting | ( | $ | setting, |
| $ | wiki, | ||
| $ | params | ||
| ) |
| $setting | string |
| $wiki | string |
| $params | array |
Definition at line 242 of file SiteConfiguration.php.
References 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.
| $setting | 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 217 of file SiteConfiguration.php.
| 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 58 of file SiteConfiguration.php.
References 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 arrayMerge(), getSetting(), and mergeParams().

| SiteConfiguration::getBool | ( | $ | setting, |
| $ | wiki, | ||
| $ | suffix = null, |
||
| $ | wikiTags = array() |
||
| ) |
Retrieves a configuration setting for a given wiki, forced to a boolean.
| $setting | 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. |
| $wikiTags | Array The tags assigned to the wiki. |
Definition at line 195 of file SiteConfiguration.php.
Retrieves an array of local databases.
Definition at line 204 of file SiteConfiguration.php.
| 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 71 of file SiteConfiguration.php.
References 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 280 of file SiteConfiguration.php.
Referenced by mergeParams(), and siteFromDB().

| SiteConfiguration::isLocalVHost | ( | $ | vhost | ) |
Returns true if the given vhost is handled locally.
| $vhost | String |
Definition at line 371 of file SiteConfiguration.php.
Definition at line 403 of file SiteConfiguration.php.
| SiteConfiguration::mergeParams | ( | $ | wiki, |
| $ | suffix, | ||
| $ | params, | ||
| $ | wikiTags | ||
| ) | [protected] |
Merge params between 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 318 of file SiteConfiguration.php.
References 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 343 of file SiteConfiguration.php.
References getWikiParams().

| SiteConfiguration::$fullLoadCallback = null |
Optional callback to load full configuration data.
Definition at line 30 of file SiteConfiguration.php.
| SiteConfiguration::$fullLoadDone = false |
Whether or not all data has been loaded.
Definition at line 33 of file SiteConfiguration.php.
| SiteConfiguration::$localVHosts = array() |
Array of domains that are local and can be handled by the same server.
Definition at line 25 of file SiteConfiguration.php.
| SiteConfiguration::$settings = array() |
The whole array of settings.
Definition at line 20 of file SiteConfiguration.php.
| SiteConfiguration::$siteParamsCallback = null |
A callback function that returns an array with the following keys (all optional):
Definition at line 47 of file SiteConfiguration.php.
| SiteConfiguration::$suffixes = array() |
Array of suffixes, for self::siteFromDB()
Definition at line 10 of file SiteConfiguration.php.
| SiteConfiguration::$wikis = array() |
Array of wikis, should be the same as $wgLocalDatabases.
Definition at line 15 of file SiteConfiguration.php.