MediaWiki  master
MWLBFactory Class Reference

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

Static Public Member Functions

static applyDefaultConfig (array $lbConf, ServiceOptions $options, ConfiguredReadOnlyMode $readOnlyMode, BagOStuff $srvCache, BagOStuff $mainStash, WANObjectCache $wanCache)
 
static getLBFactoryClass (array $config)
 Returns the LBFactory class to use and the load balancer configuration. More...
 
static logDeprecation ( $msg)
 Log a database deprecation warning. More...
 

Static Private Member Functions

static assertValidServerConfigs (array $servers, $ldDB, $ldTP)
 
static getDbTypesWithSchemas ()
 
static initServerInfo (array $server, ServiceOptions $options)
 
static injectObjectCaches (array $lbConf, BagOStuff $sCache, BagOStuff $mStash, WANObjectCache $wCache)
 
static reportIfPrefixSet ( $prefix, $dbType)
 
static reportMismatchedDBs ( $srvDB, $ldDB)
 
static reportMismatchedPrefixes ( $srvTP, $ldTP)
 

Static Private Attributes

static array $loggedDeprecations = []
 Cache of already-logged deprecation messages. More...
 

Detailed Description

MediaWiki-specific class for generating database load balancers.

Definition at line 32 of file MWLBFactory.php.

Member Function Documentation

◆ applyDefaultConfig()

static MWLBFactory::applyDefaultConfig ( array  $lbConf,
ServiceOptions  $options,
ConfiguredReadOnlyMode  $readOnlyMode,
BagOStuff  $srvCache,
BagOStuff  $mainStash,
WANObjectCache  $wanCache 
)
static
Parameters
array$lbConfConfig for LBFactory::__construct()
ServiceOptions$options
ConfiguredReadOnlyMode$readOnlyMode
BagOStuff$srvCache
BagOStuff$mainStash
WANObjectCache$wanCache
Returns
array

Definition at line 71 of file MWLBFactory.php.

References $wgCommandLineMode, MediaWiki\Config\ServiceOptions\assertRequiredOptions(), DBO_COMPRESS, DBO_SSL, MediaWiki\Config\ServiceOptions\get(), ConfiguredReadOnlyMode\getReason(), Profiler\instance(), and wfHostname().

◆ assertValidServerConfigs()

static MWLBFactory::assertValidServerConfigs ( array  $servers,
  $ldDB,
  $ldTP 
)
staticprivate
Parameters
array$servers
string$ldDBLocal domain database name
string$ldTPLocal domain prefix

Definition at line 246 of file MWLBFactory.php.

References $type.

◆ getDbTypesWithSchemas()

static MWLBFactory::getDbTypesWithSchemas ( )
staticprivate
Returns
array

Definition at line 166 of file MWLBFactory.php.

◆ getLBFactoryClass()

static MWLBFactory::getLBFactoryClass ( array  $config)
static

Returns the LBFactory class to use and the load balancer configuration.

Todo:
instead of this, use a ServiceContainer for managing the different implementations.
Parameters
array$config(e.g. $wgLBFactoryConf)
Returns
string Class name

Definition at line 326 of file MWLBFactory.php.

References wfDeprecated().

◆ initServerInfo()

static MWLBFactory::initServerInfo ( array  $server,
ServiceOptions  $options 
)
staticprivate
Parameters
array$server
ServiceOptions$options
Returns
array

Definition at line 175 of file MWLBFactory.php.

References DBO_DEBUG, DBO_DEFAULT, and MediaWiki\Config\ServiceOptions\get().

◆ injectObjectCaches()

static MWLBFactory::injectObjectCaches ( array  $lbConf,
BagOStuff  $sCache,
BagOStuff  $mStash,
WANObjectCache  $wCache 
)
staticprivate
Parameters
array$lbConf
BagOStuff$sCache
BagOStuff$mStash
WANObjectCache$wCache
Returns
array

Definition at line 219 of file MWLBFactory.php.

References BagOStuff\getQoS(), and WANObjectCache\getQoS().

◆ logDeprecation()

static MWLBFactory::logDeprecation (   $msg)
static

Log a database deprecation warning.

Parameters
string$msgDeprecation message

Definition at line 364 of file MWLBFactory.php.

References $wgDevelopmentWarnings, and wfDebugLog().

◆ reportIfPrefixSet()

static MWLBFactory::reportIfPrefixSet (   $prefix,
  $dbType 
)
staticprivate
Parameters
string$prefixTable prefix
string$dbTypeDatabase type

Definition at line 274 of file MWLBFactory.php.

References MWExceptionRenderer\AS_PRETTY, and MWExceptionRenderer\output().

◆ reportMismatchedDBs()

static MWLBFactory::reportMismatchedDBs (   $srvDB,
  $ldDB 
)
staticprivate
Parameters
string$srvDBServer config database
string$ldDBLocal DB domain database

Definition at line 287 of file MWLBFactory.php.

References MWExceptionRenderer\AS_PRETTY, and MWExceptionRenderer\output().

◆ reportMismatchedPrefixes()

static MWLBFactory::reportMismatchedPrefixes (   $srvTP,
  $ldTP 
)
staticprivate
Parameters
string$srvTPServer config table prefix
string$ldTPLocal DB domain database

Definition at line 304 of file MWLBFactory.php.

References MWExceptionRenderer\AS_PRETTY, and MWExceptionRenderer\output().

Member Data Documentation

◆ $loggedDeprecations

array MWLBFactory::$loggedDeprecations = []
staticprivate

Cache of already-logged deprecation messages.

Definition at line 35 of file MWLBFactory.php.


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