X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMediaWikiServices.php;h=f621867a509453b2f007f60eb4bd53811966e3f6;hb=bbf5f989c7e16dc8eaccaeeec1fc8f1b1440dbf0;hp=ac5fbe0108043d5754510a28889bd033e25b87c6;hpb=ff2dfbe9420b2ae8a942e1b6c3baa554d4a0a513;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MediaWikiServices.php b/includes/MediaWikiServices.php index ac5fbe0108..f621867a50 100644 --- a/includes/MediaWikiServices.php +++ b/includes/MediaWikiServices.php @@ -16,6 +16,7 @@ use MediaWiki\Linker\LinkRenderer; use MediaWiki\Linker\LinkRendererFactory; use MediaWiki\Services\SalvageableService; use MediaWiki\Services\ServiceContainer; +use MediaWiki\Services\NoSuchServiceException; use MWException; use ObjectCache; use SearchEngine; @@ -28,6 +29,7 @@ use WatchedItemQueryService; use SkinFactory; use TitleFormatter; use TitleParser; +use VirtualRESTServiceClient; use MediaWiki\Interwiki\InterwikiLookup; /** @@ -197,7 +199,14 @@ class MediaWikiServices extends ServiceContainer { */ private function salvage( self $other ) { foreach ( $this->getServiceNames() as $name ) { - $oldService = $other->peekService( $name ); + // The service could be new in the new instance and not registered in the + // other instance (e.g. an extension that was loaded after the instantiation of + // the other instance. Skip this service in this case. See T143974 + try { + $oldService = $other->peekService( $name ); + } catch ( NoSuchServiceException $e ) { + continue; + } if ( $oldService instanceof SalvageableService ) { /** @var SalvageableService $newService */ @@ -571,6 +580,14 @@ class MediaWikiServices extends ServiceContainer { return $this->getService( 'TitleParser' ); } + /** + * @since 1.28 + * @return VirtualRESTServiceClient + */ + public function getVirtualRESTServiceClient() { + return $this->getService( 'VirtualRESTServiceClient' ); + } + /////////////////////////////////////////////////////////////////////////// // NOTE: When adding a service getter here, don't forget to add a test // case for it in MediaWikiServicesTest::provideGetters() and in