*
* @ingroup Database
*/
-class LBFactoryMulti extends LBFactory {
+class LBFactoryMulti extends LBFactoryMW {
/** @var array A map of database names to section names */
private $sectionsByDB;
/**
* @param array $conf
- * @throws MWException
+ * @throws InvalidArgumentException
*/
public function __construct( array $conf ) {
parent::__construct( $conf );
foreach ( $required as $key ) {
if ( !isset( $conf[$key] ) ) {
- throw new MWException( __CLASS__ . ": $key is required in configuration" );
+ throw new InvalidArgumentException( __CLASS__ . ": $key is required in configuration" );
}
$this->$key = $conf[$key];
}
/**
* @param string $cluster
* @param bool|string $wiki
- * @throws MWException
+ * @throws InvalidArgumentException
* @return LoadBalancer
*/
protected function newExternalLB( $cluster, $wiki = false ) {
if ( !isset( $this->externalLoads[$cluster] ) ) {
- throw new MWException( __METHOD__ . ": Unknown cluster \"$cluster\"" );
+ throw new InvalidArgumentException( __METHOD__ . ": Unknown cluster \"$cluster\"" );
}
$template = $this->serverTemplate;
if ( isset( $this->externalTemplateOverrides ) ) {
* @return LoadBalancer
*/
private function newLoadBalancer( $template, $loads, $groupLoads, $readOnlyReason ) {
- $lb = new LoadBalancer( [
- 'servers' => $this->makeServerArray( $template, $loads, $groupLoads ),
- 'loadMonitor' => $this->loadMonitorClass,
- 'readOnlyReason' => $readOnlyReason,
- 'trxProfiler' => $this->trxProfiler,
- 'srvCache' => $this->srvCache,
- 'wanCache' => $this->wanCache
- ] );
-
+ $lb = new LoadBalancer( array_merge(
+ $this->baseLoadBalancerParams(),
+ [
+ 'servers' => $this->makeServerArray( $template, $loads, $groupLoads ),
+ 'loadMonitor' => $this->loadMonitorClass,
+ 'readOnlyReason' => $readOnlyReason
+ ]
+ ) );
$this->initLoadBalancer( $lb );
return $lb;