Merge "Make SpecialPageFactory a service"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 17 Aug 2018 18:53:27 +0000 (18:53 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 17 Aug 2018 18:53:27 +0000 (18:53 +0000)
1  2 
RELEASE-NOTES-1.32
includes/ServiceWiring.php
tests/phpunit/MediaWikiTestCase.php

diff --combined RELEASE-NOTES-1.32
@@@ -208,9 -208,6 +208,9 @@@ because of Phabricator reports
  * (T140807) The wgResourceLoaderLESSImportPaths configuration option was removed
    from ResourceLoader. Instead, use `@import` statements in LESS to import
    files directly from nearby directories within the same project.
 +* (T140804) The wgResourceLoaderLESSVars configuration option, deprecated
 +  since 1.30, was removed. Instead, to expose variables from PHP to LESS, use
 +  the ResourceLoaderModule::getLessVars() method.
  * The protected methods PHPSessionHandler::returnSuccess() and returnFailure(),
    only needed for PHP5 compatibility, have been removed. It now uses the boolean
    values `true` and `false` respectively.
    resetServiceForTesting( 'MagicWordFactory' ) on a MediaWikiServices.
  * mw.util.init() has been removed. This function is not needed anymore and was
    a no-op function since 1.30.
+ * SpecialPageFactory::resetList() is a no-op.  Call overrideMwServices()
+   instead.
  
  === Deprecations in 1.32 ===
  * Use of a StartProfiler.php file is deprecated in favour of placing
  * wfGetMainCache() is deprecated, use ObjectCache::getLocalClusterInstance()
    instead.
  * wfGetCache() is deprecated, use ObjectCache::getInstance() instead.
+ * All SpecialPageFactory static methods are deprecated. Instead, call the
+   methods on a SpecialPageFactory instance, which may be obtained from
+   MediaWikiServices.
  
  === Other changes in 1.32 ===
  * (T198811) The following tables have had their UNIQUE indexes turned into
@@@ -48,6 -48,7 +48,7 @@@ use MediaWiki\MediaWikiServices
  use MediaWiki\Preferences\PreferencesFactory;
  use MediaWiki\Preferences\DefaultPreferencesFactory;
  use MediaWiki\Shell\CommandFactory;
+ use MediaWiki\Special\SpecialPageFactory;
  use MediaWiki\Storage\BlobStore;
  use MediaWiki\Storage\BlobStoreFactory;
  use MediaWiki\Storage\NameTableStore;
@@@ -545,6 -546,13 +546,13 @@@ return 
                );
        },
  
+       'SpecialPageFactory' => function ( MediaWikiServices $services ) : SpecialPageFactory {
+               return new SpecialPageFactory(
+                       $services->getMainConfig(),
+                       $services->getContentLanguage()
+               );
+       },
        'StatsdDataFactory' => function ( MediaWikiServices $services ) : IBufferingStatsdDataFactory {
                return new BufferingStatsdDataFactory(
                        rtrim( $services->getMainConfig()->get( 'StatsdMetricPrefix' ), '.' )
                return new MediaWikiTitleCodec(
                        $services->getContentLanguage(),
                        $services->getGenderCache(),
 -                      $services->getMainConfig()->get( 'LocalInterwikis' )
 +                      $services->getMainConfig()->get( 'LocalInterwikis' ),
 +                      $services->getInterwikiLookup()
                );
        },
  
@@@ -947,7 -947,9 +947,9 @@@ abstract class MediaWikiTestCase extend
         * @return MediaWikiServices
         * @throws MWException
         */
-       protected function overrideMwServices( Config $configOverrides = null, array $services = [] ) {
+       protected static function overrideMwServices(
+               Config $configOverrides = null, array $services = []
+       ) {
                if ( !$configOverrides ) {
                        $configOverrides = new HashConfig();
                }
                                $user
                        );
                        // an edit always attempt to purge backlink links such as history
 -                      // pages. That is unneccessary.
 +                      // pages. That is unnecessary.
                        JobQueueGroup::singleton()->get( 'htmlCacheUpdate' )->delete();
                        // WikiPages::doEditUpdates randomly adds RC purges
                        JobQueueGroup::singleton()->get( 'recentChangesUpdate' )->delete();
                                        }
                                        $db->insert(
                                                'interwiki',
 -                                              array_map( 'get_object_vars', iterator_to_array( $this->interwikiTable ) ),
 +                                              array_values( array_map( 'get_object_vars', iterator_to_array( $this->interwikiTable ) ) ),
                                                __METHOD__
                                        );
                                }