MediaWiki REL1_39
MWLBFactory Class Reference

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

Public Member Functions

 __construct (ServiceOptions $options, ConfiguredReadOnlyMode $readOnlyMode, BagOStuff $cpStash, BagOStuff $srvCache, WANObjectCache $wanCache, CriticalSectionProvider $csProvider, StatsdDataFactoryInterface $statsdDataFactory, DatabaseFactory $databaseFactory)
 
 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
 

Detailed Description

MediaWiki-specific class for generating database load balancers.

Access: internal
For use by core ServiceWiring only.

Definition at line 42 of file MWLBFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MWLBFactory::__construct ( ServiceOptions $options,
ConfiguredReadOnlyMode $readOnlyMode,
BagOStuff $cpStash,
BagOStuff $srvCache,
WANObjectCache $wanCache,
CriticalSectionProvider $csProvider,
StatsdDataFactoryInterface $statsdDataFactory,
DatabaseFactory $databaseFactory )
Parameters
ServiceOptions$options
ConfiguredReadOnlyMode$readOnlyMode
BagOStuff$cpStash
BagOStuff$srvCache
WANObjectCache$wanCache
CriticalSectionProvider$csProvider
StatsdDataFactoryInterface$statsdDataFactory
DatabaseFactory$databaseFactory

Definition at line 114 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 139 of file MWLBFactory.php.

References DBO_COMPRESS.

◆ 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 423 of file MWLBFactory.php.

◆ 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 370 of file MWLBFactory.php.

◆ logDeprecation()

static MWLBFactory::logDeprecation ( $msg)
static

Log a database deprecation warning.

Parameters
string$msgDeprecation message

Definition at line 486 of file MWLBFactory.php.

References wfGetCaller().

◆ setDomainAliases()

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

Definition at line 389 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:
= [
'CommandLineMode',
MainConfigNames::DBcompress,
MainConfigNames::DBDefaultGroup,
MainConfigNames::DBmwschema,
MainConfigNames::DBname,
MainConfigNames::DBpassword,
MainConfigNames::DBport,
MainConfigNames::DBprefix,
MainConfigNames::DBserver,
MainConfigNames::DBservers,
MainConfigNames::DBssl,
MainConfigNames::DBtype,
MainConfigNames::DBuser,
MainConfigNames::DebugDumpSql,
MainConfigNames::DebugLogFile,
MainConfigNames::DebugToolbar,
MainConfigNames::ExternalServers,
MainConfigNames::SQLiteDataDir,
MainConfigNames::SQLMode,
]
Access: internal
For use by ServiceWiring

Definition at line 50 of file MWLBFactory.php.


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