210 $retval = $thisSetting[$wiki];
213 $retval = $thisSetting[
"+$wiki"];
217 foreach (
$params[
'tags'] as $tag ) {
222 $retval = $thisSetting[$tag];
226 if ( $retval ===
null ) {
239 $retval = $thisSetting[$suffix];
243 &&
is_array( $thisSetting[
"+$suffix"] )
245 if ( $retval ===
null ) {
257 $retval = $thisSetting[
'default'];
285 foreach ( $in as $key => $val ) {
286 $in[$key] = $this->
doReplace( $from, $to, $val );
302 public function getAll( $wiki, $suffix =
null,
$params = [], $wikiTags = [] ) {
305 foreach ( $this->
settings as $varname => $stuff ) {
308 if (
substr( $varname, 0, 1 ) ==
'+' ) {
310 $var =
substr( $varname, 1 );
332 public function getBool( $setting, $wiki, $suffix =
null, $wikiTags = [] ) {
387 $setting =
substr( $setting, 1 );
410 foreach ( $this->
settings as $varName => $setting ) {
436 # Validate the returned value
441 foreach ( $default as $name => $def ) {
466 $ret[
'suffix'] = $suffix;
475 $ret[
'params'][
'lang'] =
$ret[
'lang'];
478 $ret[
'params'][
'site'] =
$ret[
'suffix'];
494 return [ $def[
'suffix'], $def[
'lang'] ];
499 foreach ( $this->suffixes as $altSite => $suffix ) {
500 if ( $suffix ===
'' ) {
531 if ( WikiMap::isCurrentWikiId( $wiki ) ) {
535 throw new MWException(
"Variable '$name' does start with 'wg'." );
537 throw new MWException(
"Variable '$name' is not set." );
542 if (
isset( $this->cfgCache[$wiki] ) ) {
545 return $multi ?
$res : current(
$res );
550 $this->cfgCache[$wiki] = [];
552 $result = Shell::makeScriptCommand(
553 "$IP/maintenance/getConfiguration.php",
561 ->limits( [
'memory' => 0,
'filesize' => 0 ] )
565 if ( $result->getExitCode() ||
$data ===
'' ) {
566 throw new MWException(
"Failed to run getConfiguration.php: {$result->getStdout()}" );
570 throw new MWException(
"Failed to unserialize configuration array." );
572 $this->cfgCache[$wiki] = $this->cfgCache[$wiki] +
$res;
575 return $multi ?
$res : current(
$res );
609 if ( $this->fullLoadCallback && !$this->fullLoadDone ) {
611 $this->fullLoadDone =
true;
unserialize( $serialized)
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
This is a class for holding configuration settings, particularly for multi-wiki sites.
getConfig( $wiki, $settings)
Get the resolved (post-setup) configuration of a potentially foreign wiki.
$localVHosts
Array of domains that are local and can be handled by the same server.
extractAllGlobals( $wiki, $suffix=null, $params=[], $wikiTags=[])
Retrieves the values of all settings, and places them in their corresponding global variables.
$wikis
Array of wikis, should be the same as $wgLocalDatabases.
getSetting( $settingName, $wiki, array $params)
Really retrieves a configuration setting for a given wiki.
mergeParams( $wiki, $suffix, array $params, array $wikiTags)
Merge params between the ones passed to the function and the ones given by self::$siteParamsCallback ...
siteFromDB( $wiki)
Work out the site and language name from a database name.
static arrayMerge( $array1)
Merge multiple arrays together.
array $cfgCache
Configuration cache for getConfig()
string array $fullLoadCallback
Optional callback to load full configuration data.
extractGlobal( $setting, $wiki, $suffix=null, $params=[], $wikiTags=[])
Retrieves the value of a given setting, and places it in its corresponding global variable.
string array $siteParamsCallback
A callback function that returns an array with the following keys (all optional):
extractGlobalSetting( $setting, $wiki, $params)
getAll( $wiki, $suffix=null, $params=[], $wikiTags=[])
Gets all settings for a wiki.
extractVar( $setting, $wiki, $suffix, &$var, $params=[], $wikiTags=[])
Retrieves the value of a given setting, and places it in a variable passed by reference.
getWikiParams( $wiki)
Return specific settings for $wiki See the documentation of self::$siteParamsCallback for more in-dep...
getBool( $setting, $wiki, $suffix=null, $wikiTags=[])
Retrieves a configuration setting for a given wiki, forced to a boolean.
$settings
The whole array of settings.
& getLocalDatabases()
Retrieves an array of local databases.
$fullLoadDone
Whether or not all data has been loaded.
$suffixes
Array of suffixes, for self::siteFromDB()
doReplace( $from, $to, $in)
Type-safe string replace; won't do replacements on non-strings private?
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Allows to change the fields on the form that will be generated $name
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration settings
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(!isset( $args[0])) $lang