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 $srvCace, 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 setSchemaAliases (LBFactory $lbFactory, $dbType)
 

Static Public Attributes

static array $applyDefaultConfigOptions
 TODO Make this a const when HHVM support is dropped (T192166) 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 33 of file MWLBFactory.php.

Member Function Documentation

◆ applyDefaultConfig()

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

Definition at line 75 of file MWLBFactory.php.

References $options, $section, $wgCommandLineMode, as, MediaWiki\Config\ServiceOptions\assertRequiredOptions(), class, 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 257 of file MWLBFactory.php.

References $type, as, and null.

◆ getDbTypesWithSchemas()

static MWLBFactory::getDbTypesWithSchemas ( )
staticprivate
Returns
array

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

References class, and wfDeprecated().

Referenced by LBFactoryTest\testGetLBFactoryClass().

◆ initServerInfo()

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

Definition at line 179 of file MWLBFactory.php.

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

◆ 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 235 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 404 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 285 of file MWLBFactory.php.

References $e, 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 298 of file MWLBFactory.php.

References $e, 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 315 of file MWLBFactory.php.

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

◆ setSchemaAliases()

static MWLBFactory::setSchemaAliases ( LBFactory  $lbFactory,
  $dbType 
)
static
Parameters
LBFactory$lbFactory
string$dbType'mysql', 'sqlite', etc.

Definition at line 375 of file MWLBFactory.php.

References Wikimedia\Rdbms\LBFactory\setIndexAliases().

Member Data Documentation

◆ $applyDefaultConfigOptions

array MWLBFactory::$applyDefaultConfigOptions
static
Initial value:
= [
'DBcompress',
'DBDefaultGroup',
'DBmwschema',
'DBname',
'DBpassword',
'DBport',
'DBprefix',
'DBserver',
'DBservers',
'DBssl',
'DBtype',
'DBuser',
'DBWindowsAuthentication',
'DebugDumpSql',
'DebugLogFile',
'ExternalServers',
'SQLiteDataDir',
'SQLMode',
]

TODO Make this a const when HHVM support is dropped (T192166)

Since
1.34

Definition at line 44 of file MWLBFactory.php.

◆ $loggedDeprecations

array MWLBFactory::$loggedDeprecations = []
staticprivate

Cache of already-logged deprecation messages.

Definition at line 36 of file MWLBFactory.php.


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