54 parent::__construct( $conf );
56 $this->
servers = isset( $conf[
'servers'] ) ? $conf[
'servers'] : [];
57 foreach ( $this->
servers as $i => $server ) {
59 $this->
servers[$i][
'master'] =
true;
61 $this->
servers[$i][
'replica'] =
true;
65 $this->externalClusters = isset( $conf[
'externalClusters'] )
66 ? $conf[
'externalClusters']
68 $this->loadMonitorClass = isset( $conf[
'loadMonitorClass'] )
69 ? $conf[
'loadMonitorClass']
86 if ( !isset( $this->mainLB ) ) {
87 $this->mainLB = $this->
newMainLB( $domain );
95 if ( !isset( $this->externalClusters[$cluster] ) ) {
103 if ( !isset( $this->extLBs[$cluster] ) ) {
108 return $this->extLBs[$cluster];
115 'servers' => $servers,
116 'loadMonitor' => [
'class' => $this->loadMonitorClass ],
133 if ( isset( $this->mainLB ) ) {
134 call_user_func_array( $callback, array_merge( [ $this->mainLB ],
$params ) );
136 foreach ( $this->extLBs
as $lb ) {
137 call_user_func_array( $callback, array_merge( [ $lb ],
$params ) );
array[] $externalClusters
Map of (cluster => (server index => server config))
the array() calling protocol came about after MediaWiki 1.4rc1.
A simple single-master LBFactory that gets its configuration from the b/c globals.
baseLoadBalancerParams()
Base parameters to LoadBalancer::__construct()
getExternalLB($cluster)
Get a cached (tracked) load balancer for external storage.
initLoadBalancer(ILoadBalancer $lb)
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
array[] $servers
Map of (server index => server config)
newLoadBalancer(array $servers)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
newExternalLB($cluster)
Create a new load balancer for external storage.
storage can be distributed across multiple servers
forEachLB($callback, array $params=[])
Execute a function for each tracked load balancer The callback is called with the load balancer as th...