Go to the documentation of this file.
158 $required =
array(
'sectionsByDB',
'sectionLoads',
'serverTemplate' );
159 $optional =
array(
'groupLoadsBySection',
'groupLoadsByDB',
'hostsByName',
160 'externalLoads',
'externalTemplateOverrides',
'templateOverridesByServer',
161 'templateOverridesByCluster',
'masterTemplateOverrides',
162 'readOnlyBySection' );
164 foreach ( $required
as $key ) {
165 if ( !isset(
$conf[$key] ) ) {
166 throw new MWException( __CLASS__ .
": $key is required in configuration" );
168 $this->$key =
$conf[$key];
171 foreach ( $optional
as $key ) {
172 if ( isset(
$conf[$key] ) ) {
179 if ( !empty( $this->readOnlyBySection[
$section] ) ) {
181 $wgReadOnly = $this->readOnlyBySection[
$section];
190 if ( $this->lastWiki === $wiki ) {
194 if ( isset( $this->sectionsByDB[$dbName] ) ) {
195 $section = $this->sectionsByDB[$dbName];
200 $this->lastWiki = $wiki;
212 $groupLoads =
array();
213 if ( isset( $this->groupLoadsByDB[$dbName] ) ) {
214 $groupLoads = $this->groupLoadsByDB[$dbName];
217 if ( isset( $this->groupLoadsBySection[
$section] ) ) {
218 $groupLoads = array_merge_recursive( $groupLoads, $this->groupLoadsBySection[
$section] );
222 $this->serverTemplate,
236 $lb->parentInfo(
array(
'id' =>
"main-$section" ) );
237 $this->chronProt->initLB(
$lb );
251 if ( !isset( $this->externalLoads[$cluster] ) ) {
252 throw new MWException( __METHOD__ .
": Unknown cluster \"$cluster\"" );
255 if ( isset( $this->externalTemplateOverrides ) ) {
256 $template = $this->externalTemplateOverrides + $template;
258 if ( isset( $this->templateOverridesByCluster[$cluster] ) ) {
259 $template = $this->templateOverridesByCluster[$cluster] + $template;
271 if ( !isset( $this->extLBs[$cluster] ) ) {
273 $this->extLBs[$cluster]->parentInfo(
array(
'id' =>
"ext-$cluster" ) );
274 $this->chronProt->initLB( $this->extLBs[$cluster] );
277 return $this->extLBs[$cluster];
289 global $wgMasterWaitTimeout;
292 'servers' => $servers,
293 'masterWaitTimeout' => $wgMasterWaitTimeout
311 foreach ( $groupLoadsByServer
as $server => $stuff ) {
312 if ( !isset( $loads[$server] ) ) {
316 foreach ( $loads
as $serverName => $load ) {
317 $serverInfo = $template;
319 $serverInfo[
'master'] =
true;
320 if ( isset( $this->masterTemplateOverrides ) ) {
321 $serverInfo = $this->masterTemplateOverrides + $serverInfo;
325 if ( isset( $this->templateOverridesByServer[$serverName] ) ) {
326 $serverInfo = $this->templateOverridesByServer[$serverName] + $serverInfo;
328 if ( isset( $groupLoadsByServer[$serverName] ) ) {
329 $serverInfo[
'groupLoads'] = $groupLoadsByServer[$serverName];
331 if ( isset( $this->hostsByName[$serverName] ) ) {
332 $serverInfo[
'host'] = $this->hostsByName[$serverName];
334 $serverInfo[
'host'] = $serverName;
336 $serverInfo[
'hostName'] = $serverName;
337 $serverInfo[
'load'] = $load;
338 $servers[] = $serverInfo;
350 $reindexed =
array();
351 foreach ( $groupLoads
as $group => $loads ) {
352 foreach ( $loads
as $server => $load ) {
353 $reindexed[$server][$group] = $load;
366 if ( $wiki ===
false ) {
383 foreach ( $this->mainLBs
as $lb ) {
384 call_user_func_array( $callback, array_merge(
array(
$lb ),
$params ) );
386 foreach ( $this->extLBs
as $lb ) {
387 call_user_func_array( $callback, array_merge(
array(
$lb ),
$params ) );
392 foreach ( $this->mainLBs
as $lb ) {
393 $this->chronProt->shutdownLB(
$lb );
395 foreach ( $this->extLBs
as $extLB ) {
396 $this->chronProt->shutdownLB( $extLB );
398 $this->chronProt->shutdown();
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
array $masterTemplateOverrides
An override array for all master servers *.
array $externalLoads
A map of external storage cluster name to server load map *.
getDBNameAndPrefix( $wiki=false)
Get the database name and prefix based on the wiki ID.
newExternalLB( $cluster, $wiki=false)
wfSplitWikiID( $wiki)
Split a wiki ID into DB name and table prefix.
forEachLB( $callback, $params=array())
Execute a function for each tracked load balancer The callback is called with the load balancer as th...
Class for ensuring a consistent ordering of events as seen by the user, despite replication.
An interface for generating database load balancers.
array $hostsByName
A map of hostname to IP address *.
reindexGroupLoads( $groupLoads)
Take a group load array indexed by group then server, and reindex it by server then group.
array $sectionsByDB
A map of database names to section names *.
if( $wgAPIRequestLog) $lb
controlled by $wgMainCacheType controlled by $wgParserCacheType controlled by $wgMessageCacheType If you set CACHE_NONE to one of the three control default value for MediaWiki still create a but requests to it are no ops and we always fall through to the database If the cache daemon can t be it should also disable itself fairly smoothly By $wgMemc is used but when it is $parserMemc or $messageMemc this is mentioned $wgDBname
array $groupLoadsByDB
A 3-d map giving server load ratios by DB name *.
array $groupLoadsBySection
A 3-d map giving server load ratios for each section and group *.
newLoadBalancer( $template, $loads, $groupLoads)
Make a new load balancer object based on template and load array.
array $templateOverridesByCluster
A 2-d map overriding the server info by external storage cluster *.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Database load balancing object.
& getExternalLB( $cluster, $wiki=false)
commitMasterChanges()
Commit changes on all master connections.
array $sectionLoads
A 2-d map.
array $serverTemplate
A server info associative array as documented for $wgDBservers.
array $externalTemplateOverrides
A set of server info keys overriding serverTemplate for external storage.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
A multi-wiki, multi-master factory for Wikimedia and similar installations.
array $templateOverridesByServer
A 2-d map overriding serverTemplate and externalTemplateOverrides on a server-by-server basis.
array $conf
Load balancer factory configuration *.
makeServerArray( $template, $loads, $groupLoads)
Make a server array as expected by LoadBalancer::__construct, using a template and load array.
getSectionForWiki( $wiki=false)
shutdown()
Prepare all tracked load balancers for shutdown STUB.