Go to the documentation of this file.
49 if ( is_null( self::$instance ) ) {
52 self::$instance =
new $class( $wgLBFactoryConf );
68 'LBFactory_Simple' =>
'LBFactorySimple',
69 'LBFactory_Single' =>
'LBFactorySingle',
70 'LBFactory_Multi' =>
'LBFactoryMulti',
71 'LBFactory_Fake' =>
'LBFactoryFake',
74 $class = $config[
'class'];
76 if ( isset( $bcClasses[$class] ) ) {
77 $class = $bcClasses[$class];
79 '$wgLBFactoryConf must be updated. See RELEASE-NOTES for details',
91 if ( self::$instance ) {
92 self::$instance->shutdown();
93 self::$instance->forEachLBCallMethod(
'closeAll' );
94 self::$instance =
null;
121 abstract function newMainLB( $wiki =
false );
129 abstract function getMainLB( $wiki =
false );
185 call_user_func_array(
array( $loadBalancer, $methodName ),
$args );
239 global $wgDBservers, $wgMasterWaitTimeout;
240 if ( $wgDBservers ) {
241 $servers = $wgDBservers;
243 global $wgDBserver, $wgDBuser, $wgDBpassword,
$wgDBname, $wgDBtype, $wgDebugDumpSql;
244 global $wgDBssl, $wgDBcompress;
247 if ( $wgDebugDumpSql ) {
253 if ( $wgDBcompress ) {
258 'host' => $wgDBserver,
260 'password' => $wgDBpassword,
269 'servers' => $servers,
270 'masterWaitTimeout' => $wgMasterWaitTimeout
279 if ( !isset( $this->mainLB ) ) {
280 $this->mainLB = $this->
newMainLB( $wiki );
281 $this->mainLB->parentInfo(
array(
'id' =>
'main' ) );
282 $this->chronProt->initLB( $this->mainLB );
295 global $wgExternalServers;
296 if ( !isset( $wgExternalServers[$cluster] ) ) {
297 throw new MWException( __METHOD__ .
": Unknown cluster \"$cluster\"" );
301 'servers' => $wgExternalServers[$cluster]
311 if ( !isset( $this->extLBs[$cluster] ) ) {
312 $this->extLBs[$cluster] = $this->
newExternalLB( $cluster, $wiki );
313 $this->extLBs[$cluster]->parentInfo(
array(
'id' =>
"ext-$cluster" ) );
314 $this->chronProt->initLB( $this->extLBs[$cluster] );
317 return $this->extLBs[$cluster];
329 if ( isset( $this->mainLB ) ) {
330 call_user_func_array( $callback, array_merge(
array( $this->mainLB ),
$params ) );
332 foreach ( $this->extLBs
as $lb ) {
333 call_user_func_array( $callback, array_merge(
array(
$lb ),
$params ) );
338 if ( $this->mainLB ) {
339 $this->chronProt->shutdownLB( $this->mainLB );
341 foreach ( $this->extLBs
as $extLB ) {
342 $this->chronProt->shutdownLB( $extLB );
344 $this->chronProt->shutdown();
384 parent::__construct(
"Mediawiki tried to access the database via wfGetDB(). " .
385 "This is not allowed." );
& getExternalLB( $cluster, $wiki=false)
Get a cached (tracked) load balancer for external storage.
static disableBackend()
Disables all access to the load balancer, will cause all database access to throw a DBAccessError.
hasMasterChanges()
Detemine if any master connection has pending changes.
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
static & singleton()
Get an LBFactory instance.
__construct( $conf)
Construct a factory based on a configuration array (typically from $wgLBFactoryConf)
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
__construct( $conf)
Construct a factory based on a configuration array (typically from $wgLBFactoryConf)
Class for ensuring a consistent ordering of events as seen by the user, despite replication.
newExternalLB( $cluster, $wiki=false)
Create a new load balancer for external storage.
An interface for generating database load balancers.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
forEachLB( $callback, $params=array())
Execute a function for each tracked load balancer The callback is called with the load balancer as th...
rollbackMasterChanges()
Rollback changes on all master connections.
getMainLB( $wiki=false)
Get a cached (tracked) load balancer object.
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
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
newExternalLB( $cluster, $wiki=false)
Create a new load balancer for external storage.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
getMainLB( $wiki=false)
Get a cached (tracked) load balancer object.
when a variable name is used in a it is silently declared as a new masking the global
Database load balancing object.
Exception class for attempted DB access.
static setInstance( $instance)
Set the instance to be the given object.
forEachLB( $callback, $params=array())
Execute a function for each tracked load balancer The callback is called with the load balancer as th...
newExternalLB( $cluster, $wiki=false)
commitMasterChanges()
Commit changes on all master connections.
__construct( $conf)
Construct a factory based on a configuration array (typically from $wgLBFactoryConf)
ChronologyProtector $chronProt
& getExternalLB( $cluster, $wiki=false)
Get a cached (tracked) load balancer for external storage.
forEachLB( $callback, $params=array())
Execute a function for each tracked load balancer The callback is called with the load balancer as th...
shutdown()
Prepare all tracked load balancers for shutdown STUB.
& getExternalLB( $cluster, $wiki=false)
static getLBFactoryClass(array $config)
Returns the LBFactory class to use and the load balancer configuration.
shutdown()
Prepare all tracked load balancers for shutdown STUB.
newMainLB( $wiki=false)
Create a new load balancer object.
callMethod( $loadBalancer, $methodName, $args)
Private helper for forEachLBCallMethod.
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
newMainLB( $wiki=false)
Create a new load balancer object.
forEachLBCallMethod( $methodName, $args=array())
Call a method of each tracked load balancer.
A simple single-master LBFactory that gets its configuration from the b/c globals.
static destroyInstance()
Shut down, close connections and destroy the cached instance.
LBFactory class that throws an error on any attempt to use it.