MediaWiki master
MWLBFactory Class Reference

MediaWiki-specific class for generating database load balancers. More...

Public Member Functions

 __construct (ServiceOptions $options, ConfiguredReadOnlyMode $readOnlyMode, ChronologyProtector $chronologyProtector, BagOStuff $srvCache, WANObjectCache $wanCache, CriticalSectionProvider $csProvider, StatsdDataFactoryInterface $statsdDataFactory, array $virtualDomains)
 
 applyDefaultConfig (array $lbConf)
 
 applyGlobalState (ILBFactory $lbFactory, Config $config, IBufferingStatsdDataFactory $stats)
 Apply global state from the current web request or other PHP process.
 
 getLBFactoryClass (array $config)
 Decide which LBFactory class to use.
 
 setDomainAliases (ILBFactory $lbFactory)
 

Static Public Member Functions

static logDeprecation ( $msg)
 Log a database deprecation warning.
 

Public Attributes

const APPLY_DEFAULT_CONFIG_OPTIONS
 
const CORE_VIRTUAL_DOMAINS = [ 'virtual-botpasswords' ]
 

Detailed Description

MediaWiki-specific class for generating database load balancers.

Access: internal
For use by core ServiceWiring only.

Definition at line 43 of file MWLBFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MWLBFactory::__construct ( ServiceOptions $options,
ConfiguredReadOnlyMode $readOnlyMode,
ChronologyProtector $chronologyProtector,
BagOStuff $srvCache,
WANObjectCache $wanCache,
CriticalSectionProvider $csProvider,
StatsdDataFactoryInterface $statsdDataFactory,
array $virtualDomains )
Parameters
ServiceOptions$options
ConfiguredReadOnlyMode$readOnlyMode
ChronologyProtector$chronologyProtector
BagOStuff$srvCache
WANObjectCache$wanCache
CriticalSectionProvider$csProvider
StatsdDataFactoryInterface$statsdDataFactory
string[]$virtualDomains

Definition at line 116 of file MWLBFactory.php.

Member Function Documentation

◆ applyDefaultConfig()

MWLBFactory::applyDefaultConfig ( array $lbConf)
Parameters
array$lbConfConfig for LBFactory::__construct()
Returns
array
Access: internal
For use with service wiring

Definition at line 141 of file MWLBFactory.php.

References DBO_COMPRESS, Profiler\instance(), and MW_ENTRY_POINT.

◆ applyGlobalState()

MWLBFactory::applyGlobalState ( ILBFactory $lbFactory,
Config $config,
IBufferingStatsdDataFactory $stats )

Apply global state from the current web request or other PHP process.

This technically violates the principle constraint on ServiceWiring to be deterministic for a given site configuration. The exemption made here is solely to aid in debugging and influence non-nominal behaviour such as ChronologyProtector. That is, the state applied here must never change the logical destination or meaning of any database-related methods, it merely applies preferences and debugging information.

The code here must be non-essential, with LBFactory behaving the same toward its consumers regardless of whether this is applied or not.

For example, something may instantiate LBFactory for the current wiki without calling this, and its consumers must not be able to tell the difference. Likewise, in the future MediaWiki may instantiate service wiring and LBFactory for a foreign wiki in the same farm and apply the current global state to that, and that should be fine as well.

Parameters
ILBFactory$lbFactory
Config$config
IBufferingStatsdDataFactory$stats

Definition at line 431 of file MWLBFactory.php.

References Wikimedia\Rdbms\ILBFactory\getMainLB(), and Wikimedia\Rdbms\ILBFactory\setWaitForReplicationListener().

◆ getLBFactoryClass()

MWLBFactory::getLBFactoryClass ( array $config)

Decide which LBFactory class to use.

Access: internal
For use by ServiceWiring
Parameters
array$config(e.g. $wgLBFactoryConf)
Returns
string Class name

Definition at line 378 of file MWLBFactory.php.

◆ logDeprecation()

static MWLBFactory::logDeprecation ( $msg)
static

Log a database deprecation warning.

Parameters
string$msgDeprecation message

Definition at line 467 of file MWLBFactory.php.

References wfGetCaller().

◆ setDomainAliases()

MWLBFactory::setDomainAliases ( ILBFactory $lbFactory)
Parameters
ILBFactory$lbFactory

Definition at line 397 of file MWLBFactory.php.

References Wikimedia\Rdbms\ILBFactory\getLocalDomainID(), and Wikimedia\Rdbms\ILBFactory\setDomainAliases().

Member Data Documentation

◆ APPLY_DEFAULT_CONFIG_OPTIONS

const MWLBFactory::APPLY_DEFAULT_CONFIG_OPTIONS
Initial value:
= [
MainConfigNames::DBcompress,
MainConfigNames::DBDefaultGroup,
MainConfigNames::DBmwschema,
MainConfigNames::DBname,
MainConfigNames::DBpassword,
MainConfigNames::DBport,
MainConfigNames::DBprefix,
MainConfigNames::DBserver,
MainConfigNames::DBservers,
MainConfigNames::DBssl,
MainConfigNames::DBStrictWarnings,
MainConfigNames::DBtype,
MainConfigNames::DBuser,
MainConfigNames::DebugDumpSql,
MainConfigNames::DebugLogFile,
MainConfigNames::DebugToolbar,
MainConfigNames::ExternalServers,
MainConfigNames::SQLiteDataDir,
MainConfigNames::SQLMode,
MainConfigNames::VirtualDomainsMapping,
]
Access: internal
For use by ServiceWiring

Definition at line 53 of file MWLBFactory.php.

◆ CORE_VIRTUAL_DOMAINS

const MWLBFactory::CORE_VIRTUAL_DOMAINS = [ 'virtual-botpasswords' ]

Definition at line 48 of file MWLBFactory.php.


The documentation for this class was generated from the following file: