[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/ -> SiteConfiguration.php (summary)

Configuration holder, particularly for multi-wiki sites. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 611 lines (19 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

SiteConfiguration:: (17 methods):
  get()
  getSetting()
  doReplace()
  getAll()
  getBool()
  getLocalDatabases()
  extractVar()
  extractGlobal()
  extractGlobalSetting()
  extractAllGlobals()
  getWikiParams()
  mergeParams()
  siteFromDB()
  getConfig()
  isLocalVHost()
  arrayMerge()
  loadFullData()


Class: SiteConfiguration  - X-Ref

This is a class for holding configuration settings, particularly for
multi-wiki sites.

A basic synopsis:

Consider a wikifarm having three sites: two production sites, one in English
and one in German, and one testing site. You can assign them easy-to-remember
identifiers - ISO 639 codes 'en' and 'de' for language wikis, and 'beta' for
the testing wiki.

You would thus initialize the site configuration by specifying the wiki
identifiers:

get( $settingName, $wiki, $suffix = null, $params = array()   X-Ref
Retrieves a configuration setting for a given wiki.

param: string $settingName ID of the setting name to retrieve
param: string $wiki Wiki ID of the wiki in question.
param: string $suffix The suffix of the wiki in question.
param: array $params List of parameters. $.'key' is replaced by $value in all returned data.
param: array $wikiTags The tags assigned to the wiki.
return: mixed The value of the setting requested.

getSetting( $settingName, $wiki, array $params )   X-Ref
Really retrieves a configuration setting for a given wiki.

param: string $settingName ID of the setting name to retrieve.
param: string $wiki Wiki ID of the wiki in question.
param: array $params Array of parameters.
return: mixed The value of the setting requested.

doReplace( $from, $to, $in )   X-Ref
Type-safe string replace; won't do replacements on non-strings
private?

param: string $from
param: string $to
param: string|array $in
return: string

getAll( $wiki, $suffix = null, $params = array()   X-Ref
Gets all settings for a wiki

param: string $wiki Wiki ID of the wiki in question.
param: string $suffix The suffix of the wiki in question.
param: array $params List of parameters. $.'key' is replaced by $value in all returned data.
param: array $wikiTags The tags assigned to the wiki.
return: array Array of settings requested.

getBool( $setting, $wiki, $suffix = null, $wikiTags = array()   X-Ref
Retrieves a configuration setting for a given wiki, forced to a boolean.

param: string $setting ID of the setting name to retrieve
param: string $wiki Wiki ID of the wiki in question.
param: string $suffix The suffix of the wiki in question.
param: array $wikiTags The tags assigned to the wiki.
return: bool The value of the setting requested.

getLocalDatabases()   X-Ref
Retrieves an array of local databases

return: array

extractVar( $setting, $wiki, $suffix, &$var,$params = array()   X-Ref
Retrieves the value of a given setting, and places it in a variable passed by reference.

param: string $setting ID of the setting name to retrieve
param: string $wiki Wiki ID of the wiki in question.
param: string $suffix The suffix of the wiki in question.
param: array $var Reference The variable to insert the value into.
param: array $params List of parameters. $.'key' is replaced by $value in all returned data.
param: array $wikiTags The tags assigned to the wiki.

extractGlobal( $setting, $wiki, $suffix = null,$params = array()   X-Ref
Retrieves the value of a given setting, and places it in its corresponding global variable.

param: string $setting ID of the setting name to retrieve
param: string $wiki Wiki ID of the wiki in question.
param: string $suffix The suffix of the wiki in question.
param: array $params List of parameters. $.'key' is replaced by $value in all returned data.
param: array $wikiTags The tags assigned to the wiki.

extractGlobalSetting( $setting, $wiki, $params )   X-Ref

param: string $setting
param: string $wiki
param: array $params

extractAllGlobals( $wiki, $suffix = null, $params = array()   X-Ref
Retrieves the values of all settings, and places them in their corresponding global variables.

param: string $wiki Wiki ID of the wiki in question.
param: string $suffix The suffix of the wiki in question.
param: array $params List of parameters. $.'key' is replaced by $value in all returned data.
param: array $wikiTags The tags assigned to the wiki.

getWikiParams( $wiki )   X-Ref
Return specific settings for $wiki
See the documentation of self::$siteParamsCallback for more in-depth
documentation about this function

param: string $wiki
return: array

mergeParams( $wiki, $suffix, array $params, array $wikiTags )   X-Ref
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.

param: string $wiki Wiki ID of the wiki in question.
param: string $suffix The suffix of the wiki in question.
param: array $params List of parameters. $.'key' is replaced by $value in
param: array $wikiTags The tags assigned to the wiki.
return: array

siteFromDB( $db )   X-Ref
Work out the site and language name from a database name

param: string $db
return: array

getConfig( $wiki, $settings )   X-Ref
Get the resolved (post-setup) configuration of a potentially foreign wiki.
For foreign wikis, this is expensive, and only works if maintenance
scripts are setup to handle the --wiki parameter such as in wiki farms.

param: string $wiki
param: array|string $settings A setting name or array of setting names
return: mixed|mixed[] Array if $settings is an array, otherwise the value

isLocalVHost( $vhost )   X-Ref
Returns true if the given vhost is handled locally.

param: string $vhost
return: bool

arrayMerge( $array1 )   X-Ref
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

param: array $array1
return: array

loadFullData()   X-Ref
No description



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1