From: Fomafix Date: Sun, 3 Mar 2019 13:40:58 +0000 (+0100) Subject: Fix usage of MediaWikiServices in comments and documentation X-Git-Tag: 1.34.0-rc.0~2675^2 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27user%27%2C%20userid=session.user.id%29%20%7D%7D?a=commitdiff_plain;h=4b4699479957417909238f343436dc26a76eed9f;p=lhc%2Fweb%2Fwiklou.git Fix usage of MediaWikiServices in comments and documentation MediaWikiServices::getFoo() is wrong. Right is: MediaWikiServices::getInstance()->getFoo() Change-Id: Ib6d844ddfe5bd6ccd72b887a63d9ad476c8d196f --- diff --git a/HISTORY b/HISTORY index 72ff437a88..a9260699fb 100644 --- a/HISTORY +++ b/HISTORY @@ -522,8 +522,8 @@ because of Phabricator reports. * SearchResult::setExtensionData argument has been changed from accepting an array to accepting a Closure that returns the array when called. * Class CryptRand, everything in MWCryptRand except generateHex() and function - MediaWikiServices::getCryptRand() are deprecated, use random_bytes() to - generate cryptographically secure random byte sequences. + MediaWikiServices::getInstance()->getCryptRand() are deprecated, use + random_bytes() to generate cryptographically secure random byte sequences. * Parser::getConverterLanguage() is deprecated. Use ::getTargetLanguage() instead. * Language::markNoConversion() is deprecated. It confused readers because @@ -590,10 +590,12 @@ because of Phabricator reports. * All MagicWord static methods are now deprecated. Use the MagicWordFactory methods instead. * PasswordFactory::init is deprecated. To get a password factory with the - standard configuration, use MediaWikiServices::getPasswordFactory. -* $wgContLang is deprecated, use MediaWikiServices::getContentLanguage() + standard configuration, use + MediaWikiServices::getInstance()->getPasswordFactory. +* $wgContLang is deprecated, use + MediaWikiServices::getInstance()->getContentLanguage() instead. +* $wgParser is deprecated, use MediaWikiServices::getInstance()->getParser() instead. -* $wgParser is deprecated, use MediaWikiServices::getParser() instead. * wfGetMainCache() is deprecated, use ObjectCache::getLocalClusterInstance() instead. * wfGetCache() is deprecated, use ObjectCache::getInstance() instead. diff --git a/docs/injection.txt b/docs/injection.txt index 2badea98cb..83a14c730d 100644 --- a/docs/injection.txt +++ b/docs/injection.txt @@ -219,7 +219,7 @@ already known to MediaWikiServices (if not, see above). variables. * Add a constructor to MyExtHooks that takes a Bar service as a parameter. * Add a static method called newFromGlobalState() with no parameters. It should - just return new MyExtHooks( MediaWikiServices::getBar() ). + just return new MyExtHooks( MediaWikiServices::getInstance()->getBar() ). * The original static handler method onFoo( $x ) is then implemented as self::newFromGlobalState()->doFoo( $x ). diff --git a/includes/ConfiguredReadOnlyMode.php b/includes/ConfiguredReadOnlyMode.php index af7c7cbdf5..17c28ec388 100644 --- a/includes/ConfiguredReadOnlyMode.php +++ b/includes/ConfiguredReadOnlyMode.php @@ -2,7 +2,7 @@ /** * A read-only mode service which does not depend on LoadBalancer. - * To obtain an instance, use MediaWikiServices::getConfiguredReadOnlyMode(). + * To obtain an instance, use MediaWikiServices::getInstance()->getConfiguredReadOnlyMode(). * * @since 1.29 */ diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 073e539547..fb31249426 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -6458,7 +6458,7 @@ $wgStatsdServer = false; /** * Prefix for metric names sent to $wgStatsdServer. * - * @see MediaWikiServices::getStatsdDataFactory + * @see MediaWikiServices::getInstance()->getStatsdDataFactory * @see BufferingStatsdDataFactory * @since 1.25 */ diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 51fe1671d4..319bf6397e 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2657,8 +2657,8 @@ function wfGetDB( $db, $groups = [], $wiki = false ) { /** * Get a load balancer object. * - * @deprecated since 1.27, use MediaWikiServices::getDBLoadBalancer() - * or MediaWikiServices::getDBLoadBalancerFactory() instead. + * @deprecated since 1.27, use MediaWikiServices::getInstance()->getDBLoadBalancer() + * or MediaWikiServices::getInstance()->getDBLoadBalancerFactory() instead. * * @param string|bool $wiki Wiki ID, or false for the current wiki * @return \Wikimedia\Rdbms\LoadBalancer @@ -2675,7 +2675,7 @@ function wfGetLB( $wiki = false ) { /** * Get the load balancer factory object * - * @deprecated since 1.27, use MediaWikiServices::getDBLoadBalancerFactory() instead. + * @deprecated since 1.27, use MediaWikiServices::getInstance()->getDBLoadBalancerFactory() instead. * * @return \Wikimedia\Rdbms\LBFactory */ diff --git a/includes/ReadOnlyMode.php b/includes/ReadOnlyMode.php index 547c2d5efe..e767359929 100644 --- a/includes/ReadOnlyMode.php +++ b/includes/ReadOnlyMode.php @@ -4,7 +4,7 @@ use Wikimedia\Rdbms\LoadBalancer; /** * A service class for fetching the wiki's current read-only mode. - * To obtain an instance, use MediaWikiServices::getReadOnlyMode(). + * To obtain an instance, use MediaWikiServices::getInstance()->getReadOnlyMode(). * * @since 1.29 */ diff --git a/includes/Setup.php b/includes/Setup.php index f8b9546442..0cf8b51de7 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -897,7 +897,7 @@ $wgOut = RequestContext::getMain()->getOutput(); // BackCompat /** * @var Parser $wgParser - * @deprecated since 1.32, use MediaWikiServices::getParser() instead + * @deprecated since 1.32, use MediaWikiServices::getInstance()->getParser() instead */ $wgParser = new StubObject( 'wgParser', function () { return MediaWikiServices::getInstance()->getParser(); diff --git a/includes/config/ConfigFactory.php b/includes/config/ConfigFactory.php index 769364fd1f..696bbf462f 100644 --- a/includes/config/ConfigFactory.php +++ b/includes/config/ConfigFactory.php @@ -44,7 +44,7 @@ class ConfigFactory implements SalvageableService { protected $configs = []; /** - * @deprecated since 1.27, use MediaWikiServices::getConfigFactory() instead. + * @deprecated since 1.27, use MediaWikiServices::getInstance()->getConfigFactory() instead. * * @return ConfigFactory */ diff --git a/includes/dao/DBAccessBase.php b/includes/dao/DBAccessBase.php index 79c0385b03..8900962225 100644 --- a/includes/dao/DBAccessBase.php +++ b/includes/dao/DBAccessBase.php @@ -84,7 +84,7 @@ abstract class DBAccessBase implements IDBAccessObject { /** * Get the database type used for read operations. * - * @see MediaWikiServices::getDBLoadBalancer + * @see MediaWikiServices::getInstance()->getDBLoadBalancer * * @since 1.21 * diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php index 14d63a1fe0..dc8b146c3a 100644 --- a/includes/objectcache/ObjectCache.php +++ b/includes/objectcache/ObjectCache.php @@ -365,7 +365,7 @@ class ObjectCache { * * @since 1.26 * @return WANObjectCache - * @deprecated Since 1.28 Use MediaWikiServices::getMainWANObjectCache() + * @deprecated Since 1.28 Use MediaWikiServices::getInstance()->getMainWANObjectCache() */ public static function getMainWANInstance() { return MediaWikiServices::getInstance()->getMainWANObjectCache(); @@ -388,7 +388,7 @@ class ObjectCache { * * @return BagOStuff * @since 1.26 - * @deprecated Since 1.28 Use MediaWikiServices::getMainObjectStash + * @deprecated Since 1.28 Use MediaWikiServices::getInstance()->getMainObjectStash() */ public static function getMainStashInstance() { return MediaWikiServices::getInstance()->getMainObjectStash(); diff --git a/includes/password/PasswordFactory.php b/includes/password/PasswordFactory.php index f7b283be71..96cc3fe0ec 100644 --- a/includes/password/PasswordFactory.php +++ b/includes/password/PasswordFactory.php @@ -47,7 +47,8 @@ final class PasswordFactory { /** * Construct a new password factory. - * Most of the time you'll want to use MediaWikiServices::getPasswordFactory instead. + * Most of the time you'll want to use MediaWikiServices::getInstance()->getPasswordFactory + * instead. * @param array $config Mapping of password type => config * @param string $default Default password type * @see PasswordFactory::register