Merge "Allow resources to be salvaged across service resets."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 19 May 2016 12:45:16 +0000 (12:45 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 19 May 2016 12:45:16 +0000 (12:45 +0000)
1  2 
autoload.php
includes/MediaWikiServices.php
includes/Setup.php
tests/phpunit/includes/MediaWikiServicesTest.php

diff --combined autoload.php
@@@ -17,14 -17,10 +17,14 @@@ $wgAutoloadLocalClasses = 
        'AlterSharedConstraints' => __DIR__ . '/maintenance/oracle/alterSharedConstraints.php',
        'AncientPagesPage' => __DIR__ . '/includes/specials/SpecialAncientpages.php',
        'AnsiTermColorer' => __DIR__ . '/maintenance/term/MWTerm.php',
 +      'ApiAMCreateAccount' => __DIR__ . '/includes/api/ApiAMCreateAccount.php',
 +      'ApiAuthManagerHelper' => __DIR__ . '/includes/api/ApiAuthManagerHelper.php',
        'ApiBase' => __DIR__ . '/includes/api/ApiBase.php',
        'ApiBlock' => __DIR__ . '/includes/api/ApiBlock.php',
 +      'ApiChangeAuthenticationData' => __DIR__ . '/includes/api/ApiChangeAuthenticationData.php',
        'ApiCheckToken' => __DIR__ . '/includes/api/ApiCheckToken.php',
        'ApiClearHasMsg' => __DIR__ . '/includes/api/ApiClearHasMsg.php',
 +      'ApiClientLogin' => __DIR__ . '/includes/api/ApiClientLogin.php',
        'ApiComparePages' => __DIR__ . '/includes/api/ApiComparePages.php',
        'ApiContinuationManager' => __DIR__ . '/includes/api/ApiContinuationManager.php',
        'ApiCreateAccount' => __DIR__ . '/includes/api/ApiCreateAccount.php',
@@@ -52,7 -48,6 +52,7 @@@
        'ApiImageRotate' => __DIR__ . '/includes/api/ApiImageRotate.php',
        'ApiImport' => __DIR__ . '/includes/api/ApiImport.php',
        'ApiImportReporter' => __DIR__ . '/includes/api/ApiImport.php',
 +      'ApiLinkAccount' => __DIR__ . '/includes/api/ApiLinkAccount.php',
        'ApiLogin' => __DIR__ . '/includes/api/ApiLogin.php',
        'ApiLogout' => __DIR__ . '/includes/api/ApiLogout.php',
        'ApiMain' => __DIR__ . '/includes/api/ApiMain.php',
@@@ -80,7 -75,6 +80,7 @@@
        'ApiQueryAllPages' => __DIR__ . '/includes/api/ApiQueryAllPages.php',
        'ApiQueryAllRevisions' => __DIR__ . '/includes/api/ApiQueryAllRevisions.php',
        'ApiQueryAllUsers' => __DIR__ . '/includes/api/ApiQueryAllUsers.php',
 +      'ApiQueryAuthManagerInfo' => __DIR__ . '/includes/api/ApiQueryAuthManagerInfo.php',
        'ApiQueryBacklinks' => __DIR__ . '/includes/api/ApiQueryBacklinks.php',
        'ApiQueryBacklinksprop' => __DIR__ . '/includes/api/ApiQueryBacklinksprop.php',
        'ApiQueryBase' => __DIR__ . '/includes/api/ApiQueryBase.php',
        'ApiQueryWatchlist' => __DIR__ . '/includes/api/ApiQueryWatchlist.php',
        'ApiQueryWatchlistRaw' => __DIR__ . '/includes/api/ApiQueryWatchlistRaw.php',
        'ApiRawMessage' => __DIR__ . '/includes/api/ApiMessage.php',
 +      'ApiRemoveAuthenticationData' => __DIR__ . '/includes/api/ApiRemoveAuthenticationData.php',
 +      'ApiResetPassword' => __DIR__ . '/includes/api/ApiResetPassword.php',
        'ApiResult' => __DIR__ . '/includes/api/ApiResult.php',
        'ApiRevisionDelete' => __DIR__ . '/includes/api/ApiRevisionDelete.php',
        'ApiRollback' => __DIR__ . '/includes/api/ApiRollback.php',
        'AtomFeed' => __DIR__ . '/includes/Feed.php',
        'AtomicSectionUpdate' => __DIR__ . '/includes/deferred/AtomicSectionUpdate.php',
        'AttachLatest' => __DIR__ . '/maintenance/attachLatest.php',
 +      'AuthManagerSpecialPage' => __DIR__ . '/includes/specialpage/AuthManagerSpecialPage.php',
        'AuthPlugin' => __DIR__ . '/includes/AuthPlugin.php',
        'AuthPluginUser' => __DIR__ . '/includes/AuthPlugin.php',
        'AutoLoader' => __DIR__ . '/includes/AutoLoader.php',
        'DerivativeResourceLoaderContext' => __DIR__ . '/includes/resourceloader/DerivativeResourceLoaderContext.php',
        'DescribeFileOp' => __DIR__ . '/includes/filebackend/FileOp.php',
        'Diff' => __DIR__ . '/includes/diff/DairikiDiff.php',
 -      'DiffEngine' => __DIR__ . '/includes/diff/DairikiDiff.php',
 +      'DiffEngine' => __DIR__ . '/includes/diff/DiffEngine.php',
        'DiffFormatter' => __DIR__ . '/includes/diff/DiffFormatter.php',
        'DiffHistoryBlob' => __DIR__ . '/includes/HistoryBlob.php',
        'DiffOp' => __DIR__ . '/includes/diff/DairikiDiff.php',
        'FSFileOpHandle' => __DIR__ . '/includes/filebackend/FSFileBackend.php',
        'FSLockManager' => __DIR__ . '/includes/filebackend/lockmanager/FSLockManager.php',
        'FSRepo' => __DIR__ . '/includes/filerepo/FSRepo.php',
 +      'FakeAuthTemplate' => __DIR__ . '/includes/specialpage/LoginSignupSpecialPage.php',
        'FakeConverter' => __DIR__ . '/languages/FakeConverter.php',
        'FakeMaintenance' => __DIR__ . '/maintenance/Maintenance.php',
        'FakeResultWrapper' => __DIR__ . '/includes/db/DatabaseUtility.php',
        'LogPager' => __DIR__ . '/includes/logging/LogPager.php',
        'LoggedOutEditToken' => __DIR__ . '/includes/user/LoggedOutEditToken.php',
        'LoggedUpdateMaintenance' => __DIR__ . '/maintenance/Maintenance.php',
 -      'LoginForm' => __DIR__ . '/includes/specials/SpecialUserlogin.php',
 +      'LoginForm' => __DIR__ . '/includes/specialpage/LoginSignupSpecialPage.php',
 +      'LoginFormAuthManager' => __DIR__ . '/includes/specialpage/LoginSignupSpecialPage.php',
 +      'LoginFormPreAuthManager' => __DIR__ . '/includes/specials/pre-authmanager/SpecialUserlogin.php',
 +      'LoginHelper' => __DIR__ . '/includes/specials/helpers/LoginHelper.php',
 +      'LoginSignupSpecialPage' => __DIR__ . '/includes/specialpage/LoginSignupSpecialPage.php',
        'LonelyPagesPage' => __DIR__ . '/includes/specials/SpecialLonelypages.php',
        'LongPagesPage' => __DIR__ . '/includes/specials/SpecialLongpages.php',
        'MIMEsearchPage' => __DIR__ . '/includes/specials/SpecialMIMEsearch.php',
        'MagicWord' => __DIR__ . '/includes/MagicWord.php',
        'MagicWordArray' => __DIR__ . '/includes/MagicWordArray.php',
        'MailAddress' => __DIR__ . '/includes/mail/MailAddress.php',
 +      'MainConfigDependency' => __DIR__ . '/includes/cache/CacheDependency.php',
        'Maintenance' => __DIR__ . '/maintenance/Maintenance.php',
        'MaintenanceFormatInstallDoc' => __DIR__ . '/maintenance/formatInstallDoc.php',
        'MakeTestEdits' => __DIR__ . '/maintenance/makeTestEdits.php',
        'MalformedTitleException' => __DIR__ . '/includes/title/MalformedTitleException.php',
        'ManualLogEntry' => __DIR__ . '/includes/logging/LogEntry.php',
        'MapCacheLRU' => __DIR__ . '/includes/libs/MapCacheLRU.php',
 -      'MappedDiff' => __DIR__ . '/includes/diff/DairikiDiff.php',
        'MappedIterator' => __DIR__ . '/includes/libs/MappedIterator.php',
        'MarkpatrolledAction' => __DIR__ . '/includes/actions/MarkpatrolledAction.php',
        'McTest' => __DIR__ . '/maintenance/mctest.php',
        'MediaWikiSite' => __DIR__ . '/includes/site/MediaWikiSite.php',
        'MediaWikiTitleCodec' => __DIR__ . '/includes/title/MediaWikiTitleCodec.php',
        'MediaWikiVersionFetcher' => __DIR__ . '/includes/MediaWikiVersionFetcher.php',
 +      'MediaWiki\\Interwiki\\ClassicInterwikiLookup' => __DIR__ . '/includes/interwiki/ClassicInterwikiLookup.php',
 +      'MediaWiki\\Interwiki\\InterwikiLookup' => __DIR__ . '/includes/interwiki/InterwikiLookup.php',
 +      'MediaWiki\\Auth\\AbstractAuthenticationProvider' => __DIR__ . '/includes/auth/AbstractAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\AbstractPasswordPrimaryAuthenticationProvider' => __DIR__ . '/includes/auth/AbstractPasswordPrimaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\AbstractPreAuthenticationProvider' => __DIR__ . '/includes/auth/AbstractPreAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\AbstractPrimaryAuthenticationProvider' => __DIR__ . '/includes/auth/AbstractPrimaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\AbstractSecondaryAuthenticationProvider' => __DIR__ . '/includes/auth/AbstractSecondaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\AuthManager' => __DIR__ . '/includes/auth/AuthManager.php',
 +      'MediaWiki\\Auth\\AuthManagerAuthPlugin' => __DIR__ . '/includes/auth/AuthManagerAuthPlugin.php',
 +      'MediaWiki\\Auth\\AuthManagerAuthPluginUser' => __DIR__ . '/includes/auth/AuthManagerAuthPlugin.php',
 +      'MediaWiki\\Auth\\AuthPluginPrimaryAuthenticationProvider' => __DIR__ . '/includes/auth/AuthPluginPrimaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\AuthenticationProvider' => __DIR__ . '/includes/auth/AuthenticationProvider.php',
 +      'MediaWiki\\Auth\\AuthenticationRequest' => __DIR__ . '/includes/auth/AuthenticationRequest.php',
 +      'MediaWiki\\Auth\\AuthenticationResponse' => __DIR__ . '/includes/auth/AuthenticationResponse.php',
 +      'MediaWiki\\Auth\\ButtonAuthenticationRequest' => __DIR__ . '/includes/auth/ButtonAuthenticationRequest.php',
 +      'MediaWiki\\Auth\\CheckBlocksSecondaryAuthenticationProvider' => __DIR__ . '/includes/auth/CheckBlocksSecondaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\ConfirmLinkAuthenticationRequest' => __DIR__ . '/includes/auth/ConfirmLinkAuthenticationRequest.php',
 +      'MediaWiki\\Auth\\ConfirmLinkSecondaryAuthenticationProvider' => __DIR__ . '/includes/auth/ConfirmLinkSecondaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\CreateFromLoginAuthenticationRequest' => __DIR__ . '/includes/auth/CreateFromLoginAuthenticationRequest.php',
 +      'MediaWiki\\Auth\\CreatedAccountAuthenticationRequest' => __DIR__ . '/includes/auth/CreatedAccountAuthenticationRequest.php',
 +      'MediaWiki\\Auth\\CreationReasonAuthenticationRequest' => __DIR__ . '/includes/auth/CreationReasonAuthenticationRequest.php',
 +      'MediaWiki\\Auth\\EmailNotificationSecondaryAuthenticationProvider' => __DIR__ . '/includes/auth/EmailNotificationSecondaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\LegacyHookPreAuthenticationProvider' => __DIR__ . '/includes/auth/LegacyHookPreAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\LocalPasswordPrimaryAuthenticationProvider' => __DIR__ . '/includes/auth/LocalPasswordPrimaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\PasswordAuthenticationRequest' => __DIR__ . '/includes/auth/PasswordAuthenticationRequest.php',
 +      'MediaWiki\\Auth\\PasswordDomainAuthenticationRequest' => __DIR__ . '/includes/auth/PasswordDomainAuthenticationRequest.php',
 +      'MediaWiki\\Auth\\PreAuthenticationProvider' => __DIR__ . '/includes/auth/PreAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\PrimaryAuthenticationProvider' => __DIR__ . '/includes/auth/PrimaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\RememberMeAuthenticationRequest' => __DIR__ . '/includes/auth/RememberMeAuthenticationRequest.php',
 +      'MediaWiki\\Auth\\ResetPasswordSecondaryAuthenticationProvider' => __DIR__ . '/includes/auth/ResetPasswordSecondaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\SecondaryAuthenticationProvider' => __DIR__ . '/includes/auth/SecondaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\TemporaryPasswordAuthenticationRequest' => __DIR__ . '/includes/auth/TemporaryPasswordAuthenticationRequest.php',
 +      'MediaWiki\\Auth\\TemporaryPasswordPrimaryAuthenticationProvider' => __DIR__ . '/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\ThrottlePreAuthenticationProvider' => __DIR__ . '/includes/auth/ThrottlePreAuthenticationProvider.php',
 +      'MediaWiki\\Auth\\Throttler' => __DIR__ . '/includes/auth/Throttler.php',
 +      'MediaWiki\\Auth\\UserDataAuthenticationRequest' => __DIR__ . '/includes/auth/UserDataAuthenticationRequest.php',
 +      'MediaWiki\\Auth\\UsernameAuthenticationRequest' => __DIR__ . '/includes/auth/UsernameAuthenticationRequest.php',
 +      'MediaWiki\\Diff\\WordAccumulator' => __DIR__ . '/includes/diff/WordAccumulator.php',
        'MediaWiki\\Languages\\Data\\Names' => __DIR__ . '/languages/data/Names.php',
        'MediaWiki\\Languages\\Data\\ZhConversion' => __DIR__ . '/languages/data/ZhConversion.php',
        'MediaWiki\\Linker\\LinkTarget' => __DIR__ . '/includes/linker/LinkTarget.php',
        'MediaWiki\\Services\\CannotReplaceActiveServiceException' => __DIR__ . '/includes/Services/CannotReplaceActiveServiceException.php',
        'MediaWiki\\Services\\ContainerDisabledException' => __DIR__ . '/includes/Services/ContainerDisabledException.php',
        'MediaWiki\\Services\\DestructibleService' => __DIR__ . '/includes/Services/DestructibleService.php',
+       'MediaWiki\\Services\\SalvageableService' => __DIR__ . '/includes/Services/SalvageableService.php',
        'MediaWiki\\Services\\NoSuchServiceException' => __DIR__ . '/includes/Services/NoSuchServiceException.php',
        'MediaWiki\\Services\\ServiceAlreadyDefinedException' => __DIR__ . '/includes/Services/ServiceAlreadyDefinedException.php',
        'MediaWiki\\Services\\ServiceContainer' => __DIR__ . '/includes/Services/ServiceContainer.php',
        'PasswordError' => __DIR__ . '/includes/password/PasswordError.php',
        'PasswordFactory' => __DIR__ . '/includes/password/PasswordFactory.php',
        'PasswordPolicyChecks' => __DIR__ . '/includes/password/PasswordPolicyChecks.php',
 +      'PasswordReset' => __DIR__ . '/includes/user/PasswordReset.php',
        'PatchSql' => __DIR__ . '/maintenance/patchSql.php',
        'PathRouter' => __DIR__ . '/includes/PathRouter.php',
        'PathRouterPatternReplacer' => __DIR__ . '/includes/PathRouter.php',
        'RCFeedFormatter' => __DIR__ . '/includes/rcfeed/RCFeedFormatter.php',
        'RSSFeed' => __DIR__ . '/includes/Feed.php',
        'RandomPage' => __DIR__ . '/includes/specials/SpecialRandompage.php',
 -      'RangeDifference' => __DIR__ . '/includes/diff/WikiDiff3.php',
 +      'RangeDifference' => __DIR__ . '/includes/diff/DiffEngine.php',
        'RawAction' => __DIR__ . '/includes/actions/RawAction.php',
        'RawMessage' => __DIR__ . '/includes/Message.php',
        'ReadOnlyError' => __DIR__ . '/includes/exception/ReadOnlyError.php',
        'ResourceLoaderSkinModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderSkinModule.php',
        'ResourceLoaderSpecialCharacterDataModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderSpecialCharacterDataModule.php',
        'ResourceLoaderStartUpModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderStartUpModule.php',
 +      'ResourceLoaderUploadDialogModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderUploadDialogModule.php',
        'ResourceLoaderUserCSSPrefsModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php',
        'ResourceLoaderUserDefaultsModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderUserDefaultsModule.php',
        'ResourceLoaderUserGroupsModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderUserGroupsModule.php',
        'SpecialCachedPage' => __DIR__ . '/includes/specials/SpecialCachedPage.php',
        'SpecialCategories' => __DIR__ . '/includes/specials/SpecialCategories.php',
        'SpecialChangeContentModel' => __DIR__ . '/includes/specials/SpecialChangeContentModel.php',
 +      'SpecialChangeCredentials' => __DIR__ . '/includes/specials/SpecialChangeCredentials.php',
        'SpecialChangeEmail' => __DIR__ . '/includes/specials/SpecialChangeEmail.php',
 +      'SpecialChangeEmailPreAuthManager' => __DIR__ . '/includes/specials/pre-authmanager/SpecialChangeEmail.php',
        'SpecialChangePassword' => __DIR__ . '/includes/specials/SpecialChangePassword.php',
 +      'SpecialChangePasswordPreAuthManager' => __DIR__ . '/includes/specials/pre-authmanager/SpecialChangePassword.php',
        'SpecialComparePages' => __DIR__ . '/includes/specials/SpecialComparePages.php',
        'SpecialContributions' => __DIR__ . '/includes/specials/SpecialContributions.php',
        'SpecialCreateAccount' => __DIR__ . '/includes/specials/SpecialCreateAccount.php',
 +      'SpecialCreateAccountPreAuthManager' => __DIR__ . '/includes/specials/pre-authmanager/SpecialCreateAccount.php',
        'SpecialDiff' => __DIR__ . '/includes/specials/SpecialDiff.php',
        'SpecialEditTags' => __DIR__ . '/includes/specials/SpecialEditTags.php',
        'SpecialEditWatchlist' => __DIR__ . '/includes/specials/SpecialEditWatchlist.php',
        'SpecialFilepath' => __DIR__ . '/includes/specials/SpecialFilepath.php',
        'SpecialImport' => __DIR__ . '/includes/specials/SpecialImport.php',
        'SpecialJavaScriptTest' => __DIR__ . '/includes/specials/SpecialJavaScriptTest.php',
 +      'SpecialLinkAccounts' => __DIR__ . '/includes/specials/SpecialLinkAccounts.php',
        'SpecialListAdmins' => __DIR__ . '/includes/specials/SpecialListusers.php',
        'SpecialListBots' => __DIR__ . '/includes/specials/SpecialListusers.php',
        'SpecialListFiles' => __DIR__ . '/includes/specials/SpecialListfiles.php',
        'SpecialPageLanguage' => __DIR__ . '/includes/specials/SpecialPageLanguage.php',
        'SpecialPagesWithProp' => __DIR__ . '/includes/specials/SpecialPagesWithProp.php',
        'SpecialPasswordReset' => __DIR__ . '/includes/specials/SpecialPasswordReset.php',
 +      'SpecialPasswordResetPreAuthManager' => __DIR__ . '/includes/specials/pre-authmanager/SpecialPasswordReset.php',
        'SpecialPermanentLink' => __DIR__ . '/includes/specials/SpecialPermanentLink.php',
        'SpecialPreferences' => __DIR__ . '/includes/specials/SpecialPreferences.php',
        'SpecialPrefixindex' => __DIR__ . '/includes/specials/SpecialPrefixindex.php',
        'SpecialRecentChangesLinked' => __DIR__ . '/includes/specials/SpecialRecentchangeslinked.php',
        'SpecialRedirect' => __DIR__ . '/includes/specials/SpecialRedirect.php',
        'SpecialRedirectToSpecial' => __DIR__ . '/includes/specialpage/RedirectSpecialPage.php',
 +      'SpecialRemoveCredentials' => __DIR__ . '/includes/specials/SpecialRemoveCredentials.php',
        'SpecialResetTokens' => __DIR__ . '/includes/specials/SpecialResetTokens.php',
        'SpecialRevisionDelete' => __DIR__ . '/includes/specials/SpecialRevisiondelete.php',
        'SpecialRunJobs' => __DIR__ . '/includes/specials/SpecialRunJobs.php',
        'SpecialTrackingCategories' => __DIR__ . '/includes/specials/SpecialTrackingCategories.php',
        'SpecialUnblock' => __DIR__ . '/includes/specials/SpecialUnblock.php',
        'SpecialUndelete' => __DIR__ . '/includes/specials/SpecialUndelete.php',
 +      'SpecialUnlinkAccounts' => __DIR__ . '/includes/specials/SpecialUnlinkAccounts.php',
        'SpecialUnlockdb' => __DIR__ . '/includes/specials/SpecialUnlockdb.php',
        'SpecialUpload' => __DIR__ . '/includes/specials/SpecialUpload.php',
        'SpecialUploadStash' => __DIR__ . '/includes/specials/SpecialUploadStash.php',
        'SpecialUploadStashTooLargeException' => __DIR__ . '/includes/specials/SpecialUploadStash.php',
 -      'SpecialUserlogout' => __DIR__ . '/includes/specials/SpecialUserlogout.php',
 +      'SpecialUserLogin' => __DIR__ . '/includes/specials/SpecialUserLogin.php',
 +      'SpecialUserLogout' => __DIR__ . '/includes/specials/SpecialUserLogout.php',
 +      'SpecialUserlogoutPreAuthManager' => __DIR__ . '/includes/specials/pre-authmanager/SpecialUserlogout.php',
        'SpecialVersion' => __DIR__ . '/includes/specials/SpecialVersion.php',
        'SpecialWatchlist' => __DIR__ . '/includes/specials/SpecialWatchlist.php',
        'SpecialWhatLinksHere' => __DIR__ . '/includes/specials/SpecialWhatlinkshere.php',
        'WebRequestUpload' => __DIR__ . '/includes/WebRequestUpload.php',
        'WebResponse' => __DIR__ . '/includes/WebResponse.php',
        'WikiCategoryPage' => __DIR__ . '/includes/page/WikiCategoryPage.php',
 -      'WikiDiff3' => __DIR__ . '/includes/diff/WikiDiff3.php',
        'WikiExporter' => __DIR__ . '/includes/export/WikiExporter.php',
        'WikiFilePage' => __DIR__ . '/includes/page/WikiFilePage.php',
        'WikiImporter' => __DIR__ . '/includes/import/WikiImporter.php',
        'WikitextContentHandler' => __DIR__ . '/includes/content/WikitextContentHandler.php',
        'WinCacheBagOStuff' => __DIR__ . '/includes/libs/objectcache/WinCacheBagOStuff.php',
        'WithoutInterwikiPage' => __DIR__ . '/includes/specials/SpecialWithoutinterwiki.php',
 -      'WordLevelDiff' => __DIR__ . '/includes/diff/DairikiDiff.php',
 +      'WordLevelDiff' => __DIR__ . '/includes/diff/WordLevelDiff.php',
        'WrapOldPasswords' => __DIR__ . '/maintenance/wrapOldPasswords.php',
        'XCFHandler' => __DIR__ . '/includes/media/XCF.php',
        'XCacheBagOStuff' => __DIR__ . '/includes/libs/objectcache/XCacheBagOStuff.php',
        'XMPReader' => __DIR__ . '/includes/media/XMP.php',
        'XMPValidate' => __DIR__ . '/includes/media/XMPValidate.php',
        'Xhprof' => __DIR__ . '/includes/libs/Xhprof.php',
 +      'XhprofData' => __DIR__ . '/includes/libs/XhprofData.php',
        'Xml' => __DIR__ . '/includes/Xml.php',
        'XmlDumpWriter' => __DIR__ . '/includes/export/XmlDumpWriter.php',
        'XmlJsCode' => __DIR__ . '/includes/Xml.php',
@@@ -8,12 -8,11 +8,13 @@@ use GenderCache
  use GlobalVarConfig;
  use Hooks;
  use LBFactory;
 +use LinkCache;
  use Liuggio\StatsdClient\Factory\StatsdDataFactory;
  use LoadBalancer;
+ use MediaWiki\Services\SalvageableService;
  use MediaWiki\Services\ServiceContainer;
  use MWException;
 +use ObjectCache;
  use ResourceLoader;
  use SearchEngine;
  use SearchEngineConfig;
@@@ -24,7 -23,6 +25,7 @@@ use WatchedItemStore
  use SkinFactory;
  use TitleFormatter;
  use TitleParser;
 +use MediaWiki\Interwiki\InterwikiLookup;
  
  /**
   * Service locator for MediaWiki core services.
@@@ -90,7 -88,7 +91,7 @@@ class MediaWikiServices extends Service
                        // even if it's just a file name or database credentials to load
                        // configuration from.
                        $bootstrapConfig = new GlobalVarConfig();
-                       self::$instance = self::newInstance( $bootstrapConfig );
+                       self::$instance = self::newInstance( $bootstrapConfig, 'load' );
                }
  
                return self::$instance;
        /**
         * Creates a new instance of MediaWikiServices and sets it as the global default
         * instance. getInstance() will return a different MediaWikiServices object
-        * after every call to resetGlobalServiceLocator().
+        * after every call to resetGlobalInstance().
         *
         * @since 1.28
         *
         * when the configuration has changed significantly since bootstrap time, e.g.
         * during the installation process or during testing.
         *
-        * @warning Calling resetGlobalServiceLocator() may leave the application in an inconsistent
+        * @warning Calling resetGlobalInstance() may leave the application in an inconsistent
         * state. Calling this is only safe under the ASSUMPTION that NO REFERENCE to
         * any of the services managed by MediaWikiServices exist. If any service objects
         * managed by the old MediaWikiServices instance remain in use, they may INTERFERE
         *        was no previous instance, a new GlobalVarConfig object will be used to
         *        bootstrap the services.
         *
+        * @param string $quick Set this to "quick" to allow expensive resources to be re-used.
+        * See SalvageableService for details.
+        *
         * @throws MWException If called after MW_SERVICE_BOOTSTRAP_COMPLETE has been defined in
         *         Setup.php (unless MW_PHPUNIT_TEST or MEDIAWIKI_INSTALL or RUN_MAINTENANCE_IF_MAIN
         *          is defined).
         */
-       public static function resetGlobalInstance( Config $bootstrapConfig = null ) {
+       public static function resetGlobalInstance( Config $bootstrapConfig = null, $quick = '' ) {
                if ( self::$instance === null ) {
                        // no global instance yet, nothing to reset
                        return;
                        $bootstrapConfig = self::$instance->getBootstrapConfig();
                }
  
-               self::$instance->destroy();
+               $oldInstance = self::$instance;
  
                self::$instance = self::newInstance( $bootstrapConfig );
+               self::$instance->importWiring( $oldInstance, [ 'BootstrapConfig' ] );
+               if ( $quick === 'quick' ) {
+                       self::$instance->salvage( $oldInstance );
+               } else {
+                       $oldInstance->destroy();
+               }
+       }
+       /**
+        * Salvages the state of any salvageable service instances in $other.
+        *
+        * @note $other will have been destroyed when salvage() returns.
+        *
+        * @param MediaWikiServices $other
+        */
+       private function salvage( self $other ) {
+               foreach ( $this->getServiceNames() as $name ) {
+                       $oldService = $other->peekService( $name );
+                       if ( $oldService instanceof SalvageableService ) {
+                               /** @var SalvageableService $newService */
+                               $newService = $this->getService( $name );
+                               $newService->salvage( $oldService );
+                       }
+               }
+               $other->destroy();
        }
  
        /**
         * ServiceWiringFiles setting are loaded, and the MediaWikiServices hook is called.
         *
         * @param Config|null $bootstrapConfig The Config object to be registered as the
-        *        'BootstrapConfig' service. This has to contain at least the information
-        *        needed to set up the 'ConfigFactory' service. If not provided, any call
-        *        to getBootstrapConfig(), getConfigFactory, or getMainConfig will fail.
-        *        A MediaWikiServices instance without access to configuration is called
-        *        "primordial".
+        *        'BootstrapConfig' service.
+        *
+        * @param string $loadWiring set this to 'load' to load the wiring files specified
+        *        in the 'ServiceWiringFiles' setting in $bootstrapConfig.
         *
         * @return MediaWikiServices
         * @throws MWException
+        * @throws \FatalError
         */
-       private static function newInstance( Config $bootstrapConfig ) {
+       private static function newInstance( Config $bootstrapConfig, $loadWiring = '' ) {
                $instance = new self( $bootstrapConfig );
  
                // Load the default wiring from the specified files.
-               $wiringFiles = $bootstrapConfig->get( 'ServiceWiringFiles' );
-               $instance->loadWiringFiles( $wiringFiles );
+               if ( $loadWiring === 'load' ) {
+                       $wiringFiles = $bootstrapConfig->get( 'ServiceWiringFiles' );
+                       $instance->loadWiringFiles( $wiringFiles );
+               }
  
                // Provide a traditional hook point to allow extensions to configure services.
                Hooks::run( 'MediaWikiServices', [ $instance ] );
                foreach ( $destroy as $name ) {
                        $services->disableService( $name );
                }
 +
 +              ObjectCache::clear();
        }
  
        /**
         * instances to clean up.
         *
         * @param string $name
 -       * @param string $destroy Whether the service instance should be destroyed if it exists.
 +       * @param bool $destroy Whether the service instance should be destroyed if it exists.
         *        When set to false, any existing service instance will effectively be detached
         *        from the container.
         *
                return $this->getService( 'SiteStore' );
        }
  
 +      /**
 +       * @since 1.28
 +       * @return InterwikiLookup
 +       */
 +      public function getInterwikiLookup() {
 +              return $this->getService( 'InterwikiLookup' );
 +      }
 +
        /**
         * @since 1.27
         * @return StatsdDataFactory
        public function getGenderCache() {
                return $this->getService( 'GenderCache' );
        }
 +
 +      /**
 +       * @since 1.28
 +       * @return LinkCache
 +       */
 +      public function getLinkCache() {
 +              return $this->getService( 'LinkCache' );
 +      }
 +
        /**
         * @since 1.28
         * @return TitleFormatter
diff --combined includes/Setup.php
@@@ -450,22 -450,6 +450,22 @@@ if ( $wgProfileOnly ) 
        $wgDebugLogFile = '';
  }
  
 +// Disable AuthManager API modules if $wgDisableAuthManager
 +if ( $wgDisableAuthManager ) {
 +      $wgAPIModules += [
 +              'clientlogin' => 'ApiDisabled',
 +              'createaccount' => 'ApiCreateAccount', // Use the non-AuthManager version
 +              'linkaccount' => 'ApiDisabled',
 +              'unlinkaccount' => 'ApiDisabled',
 +              'changeauthenticationdata' => 'ApiDisabled',
 +              'removeauthenticationdata' => 'ApiDisabled',
 +              'resetpassword' => 'ApiDisabled',
 +      ];
 +      $wgAPIMetaModules += [
 +              'authmanagerinfo' => 'ApiQueryDisabled',
 +      ];
 +}
 +
  // Backwards compatibility with old password limits
  if ( $wgMinimalPasswordLength !== false ) {
        $wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = $wgMinimalPasswordLength;
@@@ -517,7 -501,7 +517,7 @@@ if ( !class_exists( 'AutoLoader' ) ) 
  
  // Reset the global service locator, so any services that have already been created will be
  // re-created while taking into account any custom settings and extensions.
- MediaWikiServices::resetGlobalInstance( new GlobalVarConfig() );
+ MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' );
  
  // Define a constant that indicates that the bootstrapping of the service locator
  // is complete.
@@@ -708,22 -692,9 +708,22 @@@ $wgContLang->initContLang()
  $wgRequest->interpolateTitle();
  
  if ( !is_object( $wgAuth ) ) {
 -      $wgAuth = new AuthPlugin;
 +      $wgAuth = $wgDisableAuthManager ? new AuthPlugin : new MediaWiki\Auth\AuthManagerAuthPlugin;
        Hooks::run( 'AuthPluginSetup', [ &$wgAuth ] );
  }
 +if ( !$wgDisableAuthManager &&
 +      $wgAuth && !$wgAuth instanceof MediaWiki\Auth\AuthManagerAuthPlugin
 +) {
 +      MediaWiki\Auth\AuthManager::singleton()->forcePrimaryAuthenticationProviders( [
 +              new MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider( [
 +                      'authoritative' => false,
 +              ] ),
 +              new MediaWiki\Auth\AuthPluginPrimaryAuthenticationProvider( $wgAuth ),
 +              new MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider( [
 +                      'authoritative' => true,
 +              ] ),
 +      ], '$wgAuth is ' . get_class( $wgAuth ) );
 +}
  
  // Set up the session
  $ps_session = Profiler::instance()->scopedProfileIn( $fname . '-session' );
@@@ -849,15 -820,7 +849,15 @@@ if ( !defined( 'MW_NO_SESSION' ) && !$w
        $sessionUser = MediaWiki\Session\SessionManager::getGlobalSession()->getUser();
        if ( $sessionUser->getId() === 0 && User::isValidUserName( $sessionUser->getName() ) ) {
                $ps_autocreate = Profiler::instance()->scopedProfileIn( $fname . '-autocreate' );
 -              MediaWiki\Session\SessionManager::autoCreateUser( $sessionUser );
 +              if ( $wgDisableAuthManager ) {
 +                      MediaWiki\Session\SessionManager::autoCreateUser( $sessionUser );
 +              } else {
 +                      MediaWiki\Auth\AuthManager::singleton()->autoCreateUser(
 +                              $sessionUser,
 +                              MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSSION,
 +                              true
 +                      );
 +              }
                Profiler::instance()->scopedProfileOut( $ps_autocreate );
        }
        unset( $sessionUser );
@@@ -1,7 -1,8 +1,9 @@@
  <?php
  use Liuggio\StatsdClient\Factory\StatsdDataFactory;
 +use MediaWiki\Interwiki\InterwikiLookup;
  use MediaWiki\MediaWikiServices;
+ use MediaWiki\Services\DestructibleService;
+ use MediaWiki\Services\SalvageableService;
  use MediaWiki\Services\ServiceDisabledException;
  
  /**
@@@ -9,7 -10,7 +11,7 @@@
   *
   * @group MediaWiki
   */
- class MediaWikiServicesTest extends PHPUnit_Framework_TestCase {
+ class MediaWikiServicesTest extends MediaWikiTestCase {
  
        /**
         * @return Config
                $newServices = $this->newMediaWikiServices();
                $oldServices = MediaWikiServices::forceGlobalInstance( $newServices );
  
+               $service1 = $this->getMock( SalvageableService::class );
+               $service1->expects( $this->never() )
+                       ->method( 'salvage' );
+               $newServices->defineService(
+                       'Test',
+                       function() use ( $service1 ) {
+                               return $service1;
+                       }
+               );
+               // force instantiation
+               $newServices->getService( 'Test' );
                MediaWikiServices::resetGlobalInstance( $this->newTestConfig() );
                $theServices = MediaWikiServices::getInstance();
  
+               $this->assertSame(
+                       $service1,
+                       $theServices->getService( 'Test' ),
+                       'service definition should survive reset'
+               );
+               $this->assertNotSame( $theServices, $newServices );
+               $this->assertNotSame( $theServices, $oldServices );
+               MediaWikiServices::forceGlobalInstance( $oldServices );
+       }
+       public function testResetGlobalInstance_quick() {
+               $newServices = $this->newMediaWikiServices();
+               $oldServices = MediaWikiServices::forceGlobalInstance( $newServices );
+               $service1 = $this->getMock( SalvageableService::class );
+               $service1->expects( $this->never() )
+                       ->method( 'salvage' );
+               $service2 = $this->getMock( SalvageableService::class );
+               $service2->expects( $this->once() )
+                       ->method( 'salvage' )
+                       ->with( $service1 );
+               // sequence of values the instantiator will return
+               $instantiatorReturnValues = [
+                       $service1,
+                       $service2,
+               ];
+               $newServices->defineService(
+                       'Test',
+                       function() use ( &$instantiatorReturnValues ) {
+                               return array_shift( $instantiatorReturnValues );
+                       }
+               );
+               // force instantiation
+               $newServices->getService( 'Test' );
+               MediaWikiServices::resetGlobalInstance( $this->newTestConfig(), 'quick' );
+               $theServices = MediaWikiServices::getInstance();
+               $this->assertSame( $service2, $theServices->getService( 'Test' ) );
                $this->assertNotSame( $theServices, $newServices );
                $this->assertNotSame( $theServices, $oldServices );
  
                }
  
                MediaWikiServices::forceGlobalInstance( $oldServices );
+               $newServices->destroy();
        }
  
        public function testResetChildProcessServices() {
                $newServices = $this->newMediaWikiServices();
                $oldServices = MediaWikiServices::forceGlobalInstance( $newServices );
  
-               $lbFactory = $this->getMockBuilder( 'LBFactorySimple' )
-                       ->disableOriginalConstructor()
-                       ->getMock();
+               $service1 = $this->getMock( DestructibleService::class );
+               $service1->expects( $this->once() )
+                       ->method( 'destroy' );
  
-               $lbFactory->expects( $this->once() )
+               $service2 = $this->getMock( DestructibleService::class );
+               $service2->expects( $this->never() )
                        ->method( 'destroy' );
  
-               $newServices->redefineService(
-                       'DBLoadBalancerFactory',
-                       function() use ( $lbFactory ) {
-                               return $lbFactory;
+               // sequence of values the instantiator will return
+               $instantiatorReturnValues = [
+                       $service1,
+                       $service2,
+               ];
+               $newServices->defineService(
+                       'Test',
+                       function() use ( &$instantiatorReturnValues ) {
+                               return array_shift( $instantiatorReturnValues );
                        }
                );
  
                // force the service to become active, so we can check that it does get destroyed
-               $oldLBFactory = $newServices->getService( 'DBLoadBalancerFactory' );
+               $oldTestService = $newServices->getService( 'Test' );
  
                MediaWikiServices::resetChildProcessServices();
                $finalServices = MediaWikiServices::getInstance();
  
-               $newLBFactory = $finalServices->getService( 'DBLoadBalancerFactory' );
-               $this->assertNotSame( $oldLBFactory, $newLBFactory );
+               $newTestService = $finalServices->getService( 'Test' );
+               $this->assertNotSame( $oldTestService, $newTestService );
  
                MediaWikiServices::forceGlobalInstance( $oldServices );
        }
                        'SiteStore' => [ 'SiteStore', SiteStore::class ],
                        'SiteLookup' => [ 'SiteLookup', SiteLookup::class ],
                        'StatsdDataFactory' => [ 'StatsdDataFactory', StatsdDataFactory::class ],
 +                      'InterwikiLookup' => [ 'InterwikiLookup', InterwikiLookup::class ],
                        'EventRelayerGroup' => [ 'EventRelayerGroup', EventRelayerGroup::class ],
                        'SearchEngineFactory' => [ 'SearchEngineFactory', SearchEngineFactory::class ],
                        'SearchEngineConfig' => [ 'SearchEngineConfig', SearchEngineConfig::class ],
                        'DBLoadBalancer' => [ 'DBLoadBalancer', 'LoadBalancer' ],
                        'WatchedItemStore' => [ 'WatchedItemStore', WatchedItemStore::class ],
                        'GenderCache' => [ 'GenderCache', GenderCache::class ],
 +                      'LinkCache' => [ 'LinkCache', LinkCache::class ],
                        '_MediaWikiTitleCodec' => [ '_MediaWikiTitleCodec', MediaWikiTitleCodec::class ],
                        'TitleFormatter' => [ 'TitleFormatter', TitleFormatter::class ],
                        'TitleParser' => [ 'TitleParser', TitleParser::class ],