Fix usage of MediaWikiServices in comments and documentation
authorFomafix <fomafix@googlemail.com>
Sun, 3 Mar 2019 13:40:58 +0000 (14:40 +0100)
committerD3r1ck01 <alangiderick@gmail.com>
Sun, 3 Mar 2019 14:09:33 +0000 (14:09 +0000)
MediaWikiServices::getFoo()

is wrong. Right is:

MediaWikiServices::getInstance()->getFoo()

Change-Id: Ib6d844ddfe5bd6ccd72b887a63d9ad476c8d196f

HISTORY
docs/injection.txt
includes/ConfiguredReadOnlyMode.php
includes/DefaultSettings.php
includes/GlobalFunctions.php
includes/ReadOnlyMode.php
includes/Setup.php
includes/config/ConfigFactory.php
includes/dao/DBAccessBase.php
includes/objectcache/ObjectCache.php
includes/password/PasswordFactory.php

diff --git a/HISTORY b/HISTORY
index 72ff437..a926069 100644 (file)
--- 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.
index 2badea9..83a14c7 100644 (file)
@@ -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 ).
 
index af7c7cb..17c28ec 100644 (file)
@@ -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
  */
index 073e539..fb31249 100644 (file)
@@ -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
  */
index 51fe167..319bf63 100644 (file)
@@ -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
  */
index 547c2d5..e767359 100644 (file)
@@ -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
  */
index f8b9546..0cf8b51 100644 (file)
@@ -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();
index 769364f..696bbf4 100644 (file)
@@ -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
         */
index 79c0385..8900962 100644 (file)
@@ -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
         *
index 14d63a1..dc8b146 100644 (file)
@@ -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();
index f7b283b..96cc3fe 100644 (file)
@@ -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