From 6191314e58facc3d67d14b52fce8614e62aee84d Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 30 Sep 2016 22:06:02 +0100 Subject: [PATCH] database: Rename LBFactoryMW to MWLBFactory It's no longer an LBFactory subclass (since 5d4b009cf), and the MW-prefix seems more natural for this class. The class has only existed since for about 2 weeks (since 0e5cd18b7) and is not used outside MediaWiki core across Wikimedia Git. Change-Id: I34be982b5d10ad03e062033da9c40b4a01665289 --- autoload.php | 2 +- includes/ServiceWiring.php | 4 ++-- includes/db/{loadbalancer/LBFactoryMW.php => MWLBFactory.php} | 4 ++-- tests/phpunit/includes/db/LBFactoryTest.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename includes/db/{loadbalancer/LBFactoryMW.php => MWLBFactory.php} (98%) diff --git a/autoload.php b/autoload.php index 5b99fac347..323a01d34c 100644 --- a/autoload.php +++ b/autoload.php @@ -663,7 +663,6 @@ $wgAutoloadLocalClasses = [ 'KkConverter' => __DIR__ . '/languages/classes/LanguageKk.php', 'KuConverter' => __DIR__ . '/languages/classes/LanguageKu.php', 'LBFactory' => __DIR__ . '/includes/libs/rdbms/lbfactory/LBFactory.php', - 'LBFactoryMW' => __DIR__ . '/includes/db/loadbalancer/LBFactoryMW.php', 'LBFactoryMulti' => __DIR__ . '/includes/libs/rdbms/lbfactory/LBFactoryMulti.php', 'LBFactorySimple' => __DIR__ . '/includes/libs/rdbms/lbfactory/LBFactorySimple.php', 'LBFactorySingle' => __DIR__ . '/includes/libs/rdbms/lbfactory/LBFactorySingle.php', @@ -781,6 +780,7 @@ $wgAutoloadLocalClasses = [ 'MWFileProps' => __DIR__ . '/includes/utils/MWFileProps.php', 'MWGrants' => __DIR__ . '/includes/utils/MWGrants.php', 'MWHttpRequest' => __DIR__ . '/includes/HttpFunctions.php', + 'MWLBFactory' => __DIR__ . '/includes/db/MWLBFactory.php', 'MWMemcached' => __DIR__ . '/includes/compat/MemcachedClientCompat.php', 'MWMessagePack' => __DIR__ . '/includes/libs/MWMessagePack.php', 'MWNamespace' => __DIR__ . '/includes/MWNamespace.php', diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index 604491192a..11ee616344 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -45,11 +45,11 @@ return [ 'DBLoadBalancerFactory' => function( MediaWikiServices $services ) { $mainConfig = $services->getMainConfig(); - $lbConf = LBFactoryMW::applyDefaultConfig( + $lbConf = MWLBFactory::applyDefaultConfig( $mainConfig->get( 'LBFactoryConf' ), $mainConfig ); - $class = LBFactoryMW::getLBFactoryClass( $lbConf ); + $class = MWLBFactory::getLBFactoryClass( $lbConf ); return new $class( $lbConf ); }, diff --git a/includes/db/loadbalancer/LBFactoryMW.php b/includes/db/MWLBFactory.php similarity index 98% rename from includes/db/loadbalancer/LBFactoryMW.php rename to includes/db/MWLBFactory.php index 9821da1139..96c6e9f8d3 100644 --- a/includes/db/loadbalancer/LBFactoryMW.php +++ b/includes/db/MWLBFactory.php @@ -24,10 +24,10 @@ use MediaWiki\Logger\LoggerFactory; /** - * Legacy MediaWiki-specific class for generating database load balancers + * MediaWiki-specific class for generating database load balancers * @ingroup Database */ -abstract class LBFactoryMW { +abstract class MWLBFactory { /** * @param array $lbConf Config for LBFactory::__construct() * @param Config $mainConfig Main config object from MediaWikiServices diff --git a/tests/phpunit/includes/db/LBFactoryTest.php b/tests/phpunit/includes/db/LBFactoryTest.php index 0f4484e7b6..aed2d83a7d 100644 --- a/tests/phpunit/includes/db/LBFactoryTest.php +++ b/tests/phpunit/includes/db/LBFactoryTest.php @@ -43,7 +43,7 @@ class LBFactoryTest extends MediaWikiTestCase { ]; $this->hideDeprecated( '$wgLBFactoryConf must be updated. See RELEASE-NOTES for details' ); - $result = LBFactoryMW::getLBFactoryClass( $config ); + $result = MWLBFactory::getLBFactoryClass( $config ); $this->assertEquals( $expected, $result ); } -- 2.20.1