Replace deprecated wfGetLBFactory() and wfGetLB() call

Change-Id: I500196084db57e9d74dc25a513cbebea9ae3c9a6
This commit is contained in:
WMDE-Fisch 2017-02-07 14:42:44 +01:00
parent 6e3efee722
commit 9b0a6f7a47

View file

@ -107,11 +107,17 @@ class MWEchoDbFactory {
public static function getDB( $db, $groups = [], $wiki = false ) { public static function getDB( $db, $groups = [], $wiki = false ) {
global $wgEchoCluster; global $wgEchoCluster;
$services = MediaWikiServices::getInstance();
// Use the external db defined for Echo // Use the external db defined for Echo
if ( $wgEchoCluster ) { if ( $wgEchoCluster ) {
$lb = wfGetLBFactory()->getExternalLB( $wgEchoCluster, $wiki ); $lb = $services->getDBLoadBalancerFactory()->getExternalLB( $wgEchoCluster, $wiki );
} else { } else {
$lb = wfGetLB( $wiki ); if ( $wiki === false ) {
$lb = $services->getDBLoadBalancer();
} else {
$lb = $services->getDBLoadBalancerFactory()->getMainLB( $wiki );
}
} }
return $lb->getConnection( $db, $groups, $wiki ); return $lb->getConnection( $db, $groups, $wiki );