MediaWiki REL1_39
ServiceWiring.php
Go to the documentation of this file.
1<?php
44use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
185use Wikimedia\ObjectFactory\ObjectFactory;
186use Wikimedia\Parsoid\Config\Api\DataAccess as ApiDataAccess;
187use Wikimedia\Parsoid\Config\Api\SiteConfig as ApiSiteConfig;
188use Wikimedia\Parsoid\Config\DataAccess;
189use Wikimedia\Parsoid\Config\SiteConfig;
190use Wikimedia\Parsoid\Parsoid;
192use Wikimedia\RequestTimeout\CriticalSectionProvider;
193use Wikimedia\RequestTimeout\RequestTimeout;
194use Wikimedia\Services\RecursiveServiceDependencyException;
198
200return [
201 'ActionFactory' => static function ( MediaWikiServices $services ): ActionFactory {
203 $services->getMainConfig()->get( MainConfigNames::Actions ),
204 LoggerFactory::getInstance( 'ActionFactory' ),
205 $services->getObjectFactory(),
206 $services->getHookContainer()
207 );
208 },
209
210 'ActorMigration' => static function ( MediaWikiServices $services ): ActorMigration {
213 $services->getActorStoreFactory()
214 );
215 },
216
217 'ActorNormalization' => static function ( MediaWikiServices $services ): ActorNormalization {
218 return $services->getActorStoreFactory()->getActorNormalization();
219 },
220
221 'ActorStore' => static function ( MediaWikiServices $services ): ActorStore {
222 return $services->getActorStoreFactory()->getActorStore();
223 },
224
225 'ActorStoreFactory' => static function ( MediaWikiServices $services ): ActorStoreFactory {
227 new ServiceOptions( ActorStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
228 $services->getDBLoadBalancerFactory(),
229 $services->getUserNameUtils(),
230 LoggerFactory::getInstance( 'ActorStore' )
231 );
232 },
233
234 'ArchivedRevisionLookup' => static function ( MediaWikiServices $services ): ArchivedRevisionLookup {
236 $services->getDBLoadBalancer(),
237 $services->getRevisionStore()
238 );
239 },
240
241 'AuthManager' => static function ( MediaWikiServices $services ): AuthManager {
242 $authManager = new AuthManager(
243 RequestContext::getMain()->getRequest(),
244 $services->getMainConfig(),
245 $services->getObjectFactory(),
246 $services->getHookContainer(),
247 $services->getReadOnlyMode(),
248 $services->getUserNameUtils(),
249 $services->getBlockManager(),
250 $services->getWatchlistManager(),
251 $services->getDBLoadBalancer(),
252 $services->getContentLanguage(),
253 $services->getLanguageConverterFactory(),
254 $services->getBotPasswordStore(),
255 $services->getUserFactory(),
256 $services->getUserIdentityLookup(),
257 $services->getUserOptionsManager()
258 );
259 $authManager->setLogger( LoggerFactory::getInstance( 'authentication' ) );
260 return $authManager;
261 },
262
263 'BacklinkCacheFactory' => static function ( MediaWikiServices $services ): BacklinkCacheFactory {
264 return new BacklinkCacheFactory( $services->getMainWANObjectCache() );
265 },
266
267 'BadFileLookup' => static function ( MediaWikiServices $services ): BadFileLookup {
269 static function () {
270 return wfMessage( 'bad_image_list' )->inContentLanguage()->plain();
271 },
272 $services->getLocalServerObjectCache(),
273 $services->getRepoGroup(),
274 $services->getTitleParser(),
275 $services->getHookContainer()
276 );
277 },
278
279 'BlobStore' => static function ( MediaWikiServices $services ): BlobStore {
280 return $services->getService( '_SqlBlobStore' );
281 },
282
283 'BlobStoreFactory' => static function ( MediaWikiServices $services ): BlobStoreFactory {
285 $services->getDBLoadBalancerFactory(),
286 $services->getExternalStoreAccess(),
287 $services->getMainWANObjectCache(),
288 new ServiceOptions( BlobStoreFactory::CONSTRUCTOR_OPTIONS,
289 $services->getMainConfig() )
290 );
291 },
292
293 'BlockActionInfo' => static function ( MediaWikiServices $services ): BlockActionInfo {
294 return new BlockActionInfo( $services->getHookContainer() );
295 },
296
297 'BlockErrorFormatter' => static function ( MediaWikiServices $services ): BlockErrorFormatter {
299 $services->getTitleFormatter()
300 );
301 },
302
303 'BlockManager' => static function ( MediaWikiServices $services ): BlockManager {
305 new ServiceOptions(
306 BlockManager::CONSTRUCTOR_OPTIONS,
307 $services->getMainConfig()
308 ),
309 $services->getPermissionManager(),
310 $services->getUserFactory(),
311 LoggerFactory::getInstance( 'BlockManager' ),
312 $services->getHookContainer()
313 );
314 },
315
316 'BlockPermissionCheckerFactory' => static function (
317 MediaWikiServices $services
320 new ServiceOptions(
321 BlockPermissionCheckerFactory::CONSTRUCTOR_OPTIONS,
322 $services->getMainConfig()
323 ),
324 $services->getBlockUtils()
325 );
326 },
327
328 'BlockRestrictionStore' => static function ( MediaWikiServices $services ): BlockRestrictionStore {
329 return $services->getBlockRestrictionStoreFactory()->getBlockRestrictionStore( WikiAwareEntity::LOCAL );
330 },
331
332 'BlockRestrictionStoreFactory' => static function ( MediaWikiServices $services ): BlockRestrictionStoreFactory {
334 $services->getDBLoadBalancerFactory()
335 );
336 },
337
338 'BlockUserFactory' => static function ( MediaWikiServices $services ): BlockUserFactory {
339 return $services->getService( '_UserBlockCommandFactory' );
340 },
341
342 'BlockUtils' => static function ( MediaWikiServices $services ): BlockUtils {
343 return new BlockUtils(
344 new ServiceOptions(
345 BlockUtils::CONSTRUCTOR_OPTIONS,
346 $services->getMainConfig()
347 ),
348 $services->getUserIdentityLookup(),
349 $services->getUserNameUtils()
350 );
351 },
352
353 'BotPasswordStore' => static function ( MediaWikiServices $services ): BotPasswordStore {
355 new ServiceOptions(
356 BotPasswordStore::CONSTRUCTOR_OPTIONS,
357 $services->getMainConfig()
358 ),
359 $services->getCentralIdLookup(),
360 $services->getDBLoadBalancerFactory()
361 );
362 },
363
364 'CentralIdLookup' => static function ( MediaWikiServices $services ): CentralIdLookup {
365 return $services->getCentralIdLookupFactory()->getLookup();
366 },
367
368 'CentralIdLookupFactory' => static function ( MediaWikiServices $services ): CentralIdLookupFactory {
370 new ServiceOptions( CentralIdLookupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
371 $services->getObjectFactory(),
372 $services->getUserIdentityLookup()
373 );
374 },
375
376 'ChangeTagDefStore' => static function ( MediaWikiServices $services ): NameTableStore {
377 return $services->getNameTableStoreFactory()->getChangeTagDef();
378 },
379
380 'CollationFactory' => static function ( MediaWikiServices $services ): CollationFactory {
382 new ServiceOptions(
383 CollationFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
384 $services->getObjectFactory(),
385 $services->getHookContainer()
386 );
387 },
388
389 'CommentFormatter' => static function ( MediaWikiServices $services ): CommentFormatter {
390 $linkRenderer = $services->getLinkRendererFactory()->create( [ 'renderForComment' => true ] );
391 $parserFactory = new CommentParserFactory(
392 $linkRenderer,
393 $services->getLinkBatchFactory(),
394 $services->getLinkCache(),
395 $services->getRepoGroup(),
396 RequestContext::getMain()->getLanguage(),
397 $services->getContentLanguage(),
398 $services->getTitleParser(),
399 $services->getNamespaceInfo(),
400 $services->getHookContainer()
401 );
402 return new CommentFormatter( $parserFactory );
403 },
404
405 'CommentStore' => static function ( MediaWikiServices $services ): CommentStore {
407 $services->getContentLanguage(),
409 );
410 },
411
412 'ConfigFactory' => static function ( MediaWikiServices $services ): ConfigFactory {
413 // Use the bootstrap config to initialize the ConfigFactory.
414 $registry = $services->getBootstrapConfig()->get( MainConfigNames::ConfigRegistry );
415 $factory = new ConfigFactory();
416
417 foreach ( $registry as $name => $callback ) {
418 $factory->register( $name, $callback );
419 }
420 return $factory;
421 },
422
423 'ConfigRepository' => static function ( MediaWikiServices $services ): ConfigRepository {
424 return new ConfigRepository( $services->getConfigFactory() );
425 },
426
427 'ConfigSchema' => static function ( MediaWikiServices $services ): ConfigSchema {
428 global $wgSettings; // TODO: have Setup.php declare this service
429 return $wgSettings->getConfigSchema();
430 },
431
432 'ConfiguredReadOnlyMode' => static function ( MediaWikiServices $services ): ConfiguredReadOnlyMode {
433 $config = $services->getMainConfig();
434 return new ConfiguredReadOnlyMode(
435 $config->get( MainConfigNames::ReadOnly ),
436 $config->get( MainConfigNames::ReadOnlyFile )
437 );
438 },
439
440 'ContentHandlerFactory' => static function ( MediaWikiServices $services ): IContentHandlerFactory {
441 $contentHandlerConfig = $services->getMainConfig()->get( MainConfigNames::ContentHandlers );
442
443 return new ContentHandlerFactory(
444 $contentHandlerConfig,
445 $services->getObjectFactory(),
446 $services->getHookContainer(),
447 LoggerFactory::getInstance( 'ContentHandler' )
448 );
449 },
450
451 'ContentLanguage' => static function ( MediaWikiServices $services ): Language {
452 return $services->getLanguageFactory()->getLanguage(
453 $services->getMainConfig()->get( MainConfigNames::LanguageCode ) );
454 },
455
456 'ContentModelChangeFactory' => static function ( MediaWikiServices $services ): ContentModelChangeFactory {
457 return $services->getService( '_PageCommandFactory' );
458 },
459
460 'ContentModelStore' => static function ( MediaWikiServices $services ): NameTableStore {
461 return $services->getNameTableStoreFactory()->getContentModels();
462 },
463
464 'ContentRenderer' => static function ( MediaWikiServices $services ): ContentRenderer {
465 return new ContentRenderer( $services->getContentHandlerFactory() );
466 },
467
468 'ContentTransformer' => static function ( MediaWikiServices $services ): ContentTransformer {
469 return new ContentTransformer( $services->getContentHandlerFactory() );
470 },
471
472 'ContributionsLookup' => static function ( MediaWikiServices $services ): ContributionsLookup {
474 $services->getRevisionStore(),
475 $services->getLinkRendererFactory(),
476 $services->getLinkBatchFactory(),
477 $services->getHookContainer(),
478 $services->getDBLoadBalancer(),
479 $services->getActorMigration(),
480 $services->getNamespaceInfo(),
481 $services->getCommentFormatter()
482 );
483 },
484
485 'CriticalSectionProvider' => static function ( MediaWikiServices $services ): CriticalSectionProvider {
486 $config = $services->getMainConfig();
487 $limit = $GLOBALS[ 'wgCommandLineMode' ] ? INF : $config->get( MainConfigNames::CriticalSectionTimeLimit );
488 return RequestTimeout::singleton()->createCriticalSectionProvider( $limit );
489 },
490
491 'CryptHKDF' => static function ( MediaWikiServices $services ): CryptHKDF {
492 $config = $services->getMainConfig();
493
494 $secret = $config->get( MainConfigNames::HKDFSecret ) ?: $config->get( MainConfigNames::SecretKey );
495 if ( !$secret ) {
496 throw new RuntimeException( "Cannot use MWCryptHKDF without a secret." );
497 }
498
499 // In HKDF, the context can be known to the attacker, but this will
500 // keep simultaneous runs from producing the same output.
501 $context = [ microtime(), getmypid(), gethostname() ];
502
503 // Setup salt cache. Use APC, or fallback to the main cache if it isn't setup
504 $cache = $services->getLocalServerObjectCache();
505 if ( $cache instanceof EmptyBagOStuff ) {
507 }
508
509 return new CryptHKDF( $secret, $config->get( MainConfigNames::HKDFAlgorithm ), $cache, $context );
510 },
511
512 'DatabaseBlockStore' => static function ( MediaWikiServices $services ): DatabaseBlockStore {
514 new ServiceOptions(
515 DatabaseBlockStore::CONSTRUCTOR_OPTIONS,
516 $services->getMainConfig()
517 ),
518 LoggerFactory::getInstance( 'DatabaseBlockStore' ),
519 $services->getActorStoreFactory(),
520 $services->getBlockRestrictionStore(),
521 $services->getCommentStore(),
522 $services->getHookContainer(),
523 $services->getDBLoadBalancer(),
524 $services->getReadOnlyMode(),
525 $services->getUserFactory()
526 );
527 },
528
529 'DatabaseFactory' => static function ( MediaWikiServices $services ): DatabaseFactory {
531 },
532
533 'DateFormatterFactory' => static function ( MediaWikiServices $services ): DateFormatterFactory {
535 },
536
537 'DBLoadBalancer' => static function ( MediaWikiServices $services ): Wikimedia\Rdbms\ILoadBalancer {
538 // just return the default LB from the DBLoadBalancerFactory service
539 return $services->getDBLoadBalancerFactory()->getMainLB();
540 },
541
542 'DBLoadBalancerFactory' =>
543 static function ( MediaWikiServices $services ): Wikimedia\Rdbms\LBFactory {
544 $mainConfig = $services->getMainConfig();
545 $lbFactoryConfigBuilder = $services->getDBLoadBalancerFactoryConfigBuilder();
546
547 $lbConf = $lbFactoryConfigBuilder->applyDefaultConfig(
548 $mainConfig->get( MainConfigNames::LBFactoryConf )
549 );
550
551 $class = $lbFactoryConfigBuilder->getLBFactoryClass( $lbConf );
552 $instance = new $class( $lbConf );
553
554 $lbFactoryConfigBuilder->setDomainAliases( $instance );
555
556 // NOTE: This accesses ProxyLookup from the MediaWikiServices singleton
557 // for non-essential non-nonimal purposes (via WebRequest::getIP).
558 // This state is fine (and meant) to be consistent for a given PHP process,
559 // even if applied to the service container for a different wiki.
560 $lbFactoryConfigBuilder->applyGlobalState(
561 $instance,
562 $mainConfig,
563 $services->getStatsdDataFactory()
564 );
565
566 return $instance;
567 },
568
569 'DBLoadBalancerFactoryConfigBuilder' => static function ( MediaWikiServices $services ): MWLBFactory {
570 $cpStashType = $services->getMainConfig()->get( MainConfigNames::ChronologyProtectorStash );
571 if ( is_string( $cpStashType ) ) {
572 $cpStash = ObjectCache::getInstance( $cpStashType );
573 } else {
574 try {
576 } catch ( RecursiveServiceDependencyException $e ) {
577 $cpStash = new EmptyBagOStuff(); // T141804: handle cases like CACHE_DB
578 }
579 }
580
581 try {
582 $wanCache = $services->getMainWANObjectCache();
583 } catch ( RecursiveServiceDependencyException $e ) {
584 $wanCache = WANObjectCache::newEmpty(); // T141804: handle cases like CACHE_DB
585 }
586
587 $srvCache = $services->getLocalServerObjectCache();
588 if ( $srvCache instanceof EmptyBagOStuff ) {
589 // Use process cache if no APCU or other local-server cache (e.g. on CLI)
590 $srvCache = new HashBagOStuff( [ 'maxKeys' => 100 ] );
591 }
592 return new MWLBFactory(
593 new ServiceOptions( MWLBFactory::APPLY_DEFAULT_CONFIG_OPTIONS, $services->getMainConfig() ),
594 $services->getConfiguredReadOnlyMode(),
595 $cpStash,
596 $srvCache,
597 $wanCache,
598 $services->getCriticalSectionProvider(),
599 $services->getStatsdDataFactory(),
600 $services->getDatabaseFactory()
601 );
602 },
603
604 'DeletePageFactory' => static function ( MediaWikiServices $services ): DeletePageFactory {
605 return $services->getService( '_PageCommandFactory' );
606 },
607
608 'Emailer' => static function ( MediaWikiServices $services ): IEmailer {
609 return new Emailer();
610 },
611
612 'EventRelayerGroup' => static function ( MediaWikiServices $services ): EventRelayerGroup {
613 return new EventRelayerGroup( $services->getMainConfig()->get( MainConfigNames::EventRelayerConfig ) );
614 },
615
616 'ExternalStoreAccess' => static function ( MediaWikiServices $services ): ExternalStoreAccess {
618 $services->getExternalStoreFactory(),
619 LoggerFactory::getInstance( 'ExternalStore' )
620 );
621 },
622
623 'ExternalStoreFactory' => static function ( MediaWikiServices $services ): ExternalStoreFactory {
624 $config = $services->getMainConfig();
625 $writeStores = $config->get( MainConfigNames::DefaultExternalStore );
626
627 return new ExternalStoreFactory(
628 $config->get( MainConfigNames::ExternalStores ),
629 ( $writeStores !== false ) ? (array)$writeStores : [],
630 $services->getDBLoadBalancer()->getLocalDomainID(),
631 LoggerFactory::getInstance( 'ExternalStore' )
632 );
633 },
634
635 'FileBackendGroup' => static function ( MediaWikiServices $services ): FileBackendGroup {
636 $mainConfig = $services->getMainConfig();
637
639 $fallbackWikiId = WikiMap::getWikiIdFromDbDomain( $ld );
640 // If the local wiki ID and local domain ID do not match, probably due to a non-default
641 // schema, issue a warning. A non-default schema indicates that it might be used to
642 // disambiguate different wikis.
643 $legacyDomainId = strlen( $ld->getTablePrefix() )
644 ? "{$ld->getDatabase()}-{$ld->getTablePrefix()}"
645 : $ld->getDatabase();
646 if ( $ld->getSchema() !== null && $legacyDomainId !== $fallbackWikiId ) {
647 wfWarn(
648 "Legacy default 'domainId' is '$legacyDomainId' but wiki ID is '$fallbackWikiId'."
649 );
650 }
651
652 $cache = $services->getLocalServerObjectCache();
653 if ( $cache instanceof EmptyBagOStuff ) {
654 $cache = new HashBagOStuff();
655 }
656
657 return new FileBackendGroup(
658 new ServiceOptions( FileBackendGroup::CONSTRUCTOR_OPTIONS, $mainConfig,
659 [ 'fallbackWikiId' => $fallbackWikiId ] ),
660 $services->getConfiguredReadOnlyMode(),
661 $cache,
662 $services->getMainWANObjectCache(),
663 $services->getMimeAnalyzer(),
664 $services->getLockManagerGroupFactory(),
665 $services->getTempFSFileFactory(),
666 $services->getObjectFactory()
667 );
668 },
669
670 'GenderCache' => static function ( MediaWikiServices $services ): GenderCache {
671 $nsInfo = $services->getNamespaceInfo();
672 // Database layer may be disabled, so processing without database connection
673 $dbLoadBalancer = $services->isServiceDisabled( 'DBLoadBalancer' )
674 ? null
675 : $services->getDBLoadBalancer();
676 return new GenderCache( $nsInfo, $dbLoadBalancer, $services->get( '_DefaultOptionsLookup' ) );
677 },
678
679 'GlobalIdGenerator' => static function ( MediaWikiServices $services ): GlobalIdGenerator {
680 $mainConfig = $services->getMainConfig();
681
682 return new GlobalIdGenerator(
683 $mainConfig->get( MainConfigNames::TmpDirectory ),
684 static function ( $command ) {
685 return wfShellExec( $command );
686 }
687 );
688 },
689
690 'GrantsInfo' => static function ( MediaWikiServices $services ): GrantsInfo {
691 return new GrantsInfo(
692 new ServiceOptions(
693 GrantsInfo::CONSTRUCTOR_OPTIONS,
694 $services->getMainConfig()
695 )
696 );
697 },
698
699 'GrantsLocalization' => static function ( MediaWikiServices $services ): GrantsLocalization {
701 $services->getGrantsInfo(),
702 $services->getLinkRenderer(),
703 $services->getLanguageFactory(),
704 $services->getContentLanguage()
705 );
706 },
707
708 'GroupPermissionsLookup' => static function ( MediaWikiServices $services ): GroupPermissionsLookup {
710 new ServiceOptions( GroupPermissionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig() )
711 );
712 },
713
714 'HookContainer' => static function ( MediaWikiServices $services ): HookContainer {
715 $extRegistry = ExtensionRegistry::getInstance();
716 $extDeprecatedHooks = $extRegistry->getAttribute( 'DeprecatedHooks' );
717 $deprecatedHooks = new DeprecatedHooks( $extDeprecatedHooks );
718 $hookRegistry = new GlobalHookRegistry( $extRegistry, $deprecatedHooks );
719 return new HookContainer(
720 $hookRegistry,
721 $services->getObjectFactory()
722 );
723 },
724
725 'HtmlCacheUpdater' => static function ( MediaWikiServices $services ): HtmlCacheUpdater {
726 $config = $services->getMainConfig();
727
728 return new HtmlCacheUpdater(
729 $services->getHookContainer(),
730 $services->getTitleFactory(),
731 $config->get( MainConfigNames::CdnReboundPurgeDelay ),
732 $config->get( MainConfigNames::UseFileCache ),
733 $config->get( MainConfigNames::CdnMaxAge )
734 );
735 },
736
737 'HTMLTransformFactory' => static function ( MediaWikiServices $services ): HTMLTransformFactory {
739 $services->getService( '_Parsoid' ),
740 $services->getMainConfig()->get( MainConfigNames::ParsoidSettings ),
741 $services->getParsoidPageConfigFactory()
742 );
743 },
744
745 'HttpRequestFactory' =>
746 static function ( MediaWikiServices $services ): HttpRequestFactory {
748 new ServiceOptions(
749 HttpRequestFactory::CONSTRUCTOR_OPTIONS,
750 $services->getMainConfig()
751 ),
752 LoggerFactory::getInstance( 'http' )
753 );
754 },
755
756 'InterwikiLookup' => static function ( MediaWikiServices $services ): InterwikiLookup {
757 $config = $services->getMainConfig();
758 return new ClassicInterwikiLookup(
759 $services->getContentLanguage(),
760 $services->getMainWANObjectCache(),
761 $services->getHookContainer(),
762 $services->getDBLoadBalancer(),
763 $config->get( MainConfigNames::InterwikiExpiry ),
764 $config->get( MainConfigNames::InterwikiCache ),
765 $config->get( MainConfigNames::InterwikiScopes ),
766 $config->get( MainConfigNames::InterwikiFallbackSite )
767 );
768 },
769
770 'JobQueueGroup' => static function ( MediaWikiServices $services ): JobQueueGroup {
771 return $services->getJobQueueGroupFactory()->makeJobQueueGroup();
772 },
773
774 'JobQueueGroupFactory' => static function ( MediaWikiServices $services ): JobQueueGroupFactory {
776 new ServiceOptions( JobQueueGroupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
777 $services->getConfiguredReadOnlyMode(),
778 $services->getStatsdDataFactory(),
779 $services->getMainWANObjectCache(),
780 $services->getGlobalIdGenerator()
781 );
782 },
783
784 'JobRunner' => static function ( MediaWikiServices $services ): JobRunner {
785 return new JobRunner(
786 new ServiceOptions( JobRunner::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
787 $services->getDBLoadBalancerFactory(),
788 $services->getJobQueueGroup(),
789 $services->getReadOnlyMode(),
790 $services->getLinkCache(),
791 $services->getStatsdDataFactory(),
792 LoggerFactory::getInstance( 'runJobs' )
793 );
794 },
795
796 'JsonCodec' => static function ( MediaWikiServices $services ): JsonCodec {
797 return new JsonCodec();
798 },
799
800 'LanguageConverterFactory' => static function ( MediaWikiServices $services ): LanguageConverterFactory {
801 $usePigLatinVariant = $services->getMainConfig()->get( MainConfigNames::UsePigLatinVariant );
802 $isConversionDisabled = $services->getMainConfig()->get( MainConfigNames::DisableLangConversion );
803 $isTitleConversionDisabled = $services->getMainConfig()->get( MainConfigNames::DisableTitleConversion );
804 return new LanguageConverterFactory(
805 $services->getObjectFactory(),
806 $usePigLatinVariant,
807 $isConversionDisabled,
808 $isTitleConversionDisabled,
809 static function () use ( $services ) {
810 return $services->getContentLanguage();
811 }
812 );
813 },
814
815 'LanguageFactory' => static function ( MediaWikiServices $services ): LanguageFactory {
817 new ServiceOptions( LanguageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
818 $services->getNamespaceInfo(),
819 $services->getLocalisationCache(),
820 $services->getLanguageNameUtils(),
821 $services->getLanguageFallback(),
822 $services->getLanguageConverterFactory(),
823 $services->getHookContainer(),
824 $services->getMainConfig()
825 );
826 },
827
828 'LanguageFallback' => static function ( MediaWikiServices $services ): LanguageFallback {
830 $services->getMainConfig()->get( MainConfigNames::LanguageCode ),
831 $services->getLocalisationCache(),
832 $services->getLanguageNameUtils()
833 );
834 },
835
836 'LanguageNameUtils' => static function ( MediaWikiServices $services ): LanguageNameUtils {
838 new ServiceOptions(
839 LanguageNameUtils::CONSTRUCTOR_OPTIONS,
840 $services->getMainConfig()
841 ),
842 $services->getHookContainer()
843 );
844 },
845
846 'LinkBatchFactory' => static function ( MediaWikiServices $services ): LinkBatchFactory {
848 $services->getLinkCache(),
849 $services->getTitleFormatter(),
850 $services->getContentLanguage(),
851 $services->getGenderCache(),
852 $services->getDBLoadBalancer(),
853 $services->getLinksMigration(),
854 LoggerFactory::getInstance( 'LinkBatch' )
855 );
856 },
857
858 'LinkCache' => static function ( MediaWikiServices $services ): LinkCache {
859 // Database layer may be disabled, so processing without database connection
860 $dbLoadBalancer = $services->isServiceDisabled( 'DBLoadBalancer' )
861 ? null
862 : $services->getDBLoadBalancer();
863 $linkCache = new LinkCache(
864 $services->getTitleFormatter(),
865 $services->getMainWANObjectCache(),
866 $services->getNamespaceInfo(),
867 $dbLoadBalancer
868 );
869 $linkCache->setLogger( LoggerFactory::getInstance( 'LinkCache' ) );
870 return $linkCache;
871 },
872
873 'LinkRenderer' => static function ( MediaWikiServices $services ): LinkRenderer {
874 return $services->getLinkRendererFactory()->create();
875 },
876
877 'LinkRendererFactory' => static function ( MediaWikiServices $services ): LinkRendererFactory {
879 $services->getTitleFormatter(),
880 $services->getLinkCache(),
881 $services->getSpecialPageFactory(),
882 $services->getHookContainer()
883 );
884 },
885
886 'LinksMigration' => static function ( MediaWikiServices $services ): LinksMigration {
888 $services->getMainConfig(),
889 $services->getLinkTargetLookup()
890 );
891 },
892
893 'LinkTargetLookup' => static function ( MediaWikiServices $services ): LinkTargetLookup {
895 $services->getDBLoadBalancer(),
896 $services->getLocalServerObjectCache(),
897 $services->getMainWANObjectCache()
898 );
899 },
900
901 'LocalisationCache' => static function ( MediaWikiServices $services ): LocalisationCache {
902 $conf = $services->getMainConfig()->get( MainConfigNames::LocalisationCacheConf );
903
904 $logger = LoggerFactory::getInstance( 'localisation' );
905
907 $conf, $services->getMainConfig()->get( MainConfigNames::CacheDirectory ) );
908 $logger->debug( 'LocalisationCache using store ' . get_class( $store ) );
909
910 return new $conf['class'](
911 new ServiceOptions(
912 LocalisationCache::CONSTRUCTOR_OPTIONS,
913 // Two of the options are stored in $wgLocalisationCacheConf
914 $conf,
915 // In case someone set that config variable and didn't reset all keys, set defaults.
916 [
917 'forceRecache' => false,
918 'manualRecache' => false,
919 ],
920 // Some other options come from config itself
921 $services->getMainConfig()
922 ),
923 $store,
924 $logger,
925 [ static function () use ( $services ) {
926 // NOTE: Make sure we use the same cache object that is assigned in the
927 // constructor of the MessageBlobStore class used by ResourceLoader.
928 // T231866: Avoid circular dependency via ResourceLoader.
929 MessageBlobStore::clearGlobalCacheEntry( $services->getMainWANObjectCache() );
930 } ],
931 $services->getLanguageNameUtils(),
932 $services->getHookContainer()
933 );
934 },
935
936 'LocalServerObjectCache' => static function ( MediaWikiServices $services ): BagOStuff {
937 return ObjectCache::makeLocalServerCache();
938 },
939
940 'LockManagerGroupFactory' => static function ( MediaWikiServices $services ): LockManagerGroupFactory {
942 WikiMap::getCurrentWikiDbDomain()->getId(),
943 $services->getMainConfig()->get( MainConfigNames::LockManagers )
944 );
945 },
946
947 'MagicWordFactory' => static function ( MediaWikiServices $services ): MagicWordFactory {
949 $services->getContentLanguage(),
950 $services->getHookContainer()
951 );
952 },
953
954 'MainConfig' => static function ( MediaWikiServices $services ): Config {
955 // Use the 'main' config from the ConfigFactory service.
956 return $services->getConfigFactory()->makeConfig( 'main' );
957 },
958
959 'MainObjectStash' => static function ( MediaWikiServices $services ): BagOStuff {
960 $mainConfig = $services->getMainConfig();
961
962 $id = $mainConfig->get( MainConfigNames::MainStash );
963 $params = $mainConfig->get( MainConfigNames::ObjectCaches )[$id] ?? null;
964 if ( !$params ) {
965 throw new UnexpectedValueException(
966 "\$wgObjectCaches must have \"$id\" set (via \$wgMainStash)"
967 );
968 }
969
970 $params['stats'] = $services->getStatsdDataFactory();
971
972 $store = ObjectCache::newFromParams( $params, $mainConfig );
973 $store->getLogger()->debug( 'MainObjectStash using store {class}', [
974 'class' => get_class( $store )
975 ] );
976
977 return $store;
978 },
979
980 'MainWANObjectCache' => static function ( MediaWikiServices $services ): WANObjectCache {
981 $mainConfig = $services->getMainConfig();
982
983 $wanId = $mainConfig->get( MainConfigNames::MainWANCache );
984 $wanParams = $mainConfig->get( MainConfigNames::WANObjectCaches )[$wanId] ?? null;
985 if ( !$wanParams ) {
986 throw new UnexpectedValueException(
987 "wgWANObjectCaches must have \"$wanId\" set (via wgMainWANCache)"
988 );
989 }
990
991 $cacheId = $wanParams['cacheId'];
992 $wanClass = $wanParams['class'];
993 unset( $wanParams['cacheId'] );
994 unset( $wanParams['class'] );
995
996 $storeParams = $mainConfig->get( MainConfigNames::ObjectCaches )[$cacheId] ?? null;
997 if ( !$storeParams ) {
998 throw new UnexpectedValueException(
999 "wgObjectCaches must have \"$cacheId\" set (via wgWANObjectCaches)"
1000 );
1001 }
1002 $storeParams['stats'] = $services->getStatsdDataFactory();
1003 $store = ObjectCache::newFromParams( $storeParams, $mainConfig );
1004 $logger = $store->getLogger();
1005 $logger->debug( 'MainWANObjectCache using store {class}', [
1006 'class' => get_class( $store )
1007 ] );
1008
1009 $wanParams['cache'] = $store;
1010 $wanParams['logger'] = $logger;
1011 $wanParams['secret'] = $wanParams['secret'] ?? $mainConfig->get( MainConfigNames::SecretKey );
1012 if ( !$GLOBALS[ 'wgCommandLineMode' ] ) {
1013 // Send the statsd data post-send on HTTP requests; avoid in CLI mode (T181385)
1014 $wanParams['stats'] = $services->getStatsdDataFactory();
1015 // Let pre-emptive refreshes happen post-send on HTTP requests
1016 $wanParams['asyncHandler'] = [ DeferredUpdates::class, 'addCallableUpdate' ];
1017 }
1018
1019 $instance = new $wanClass( $wanParams );
1020
1021 '@phan-var WANObjectCache $instance';
1022 return $instance;
1023 },
1024
1025 'MediaHandlerFactory' => static function ( MediaWikiServices $services ): MediaHandlerFactory {
1027 LoggerFactory::getInstance( 'MediaHandlerFactory' ),
1028 $services->getMainConfig()->get( MainConfigNames::MediaHandlers )
1029 );
1030 },
1031
1032 'MergeHistoryFactory' => static function ( MediaWikiServices $services ): MergeHistoryFactory {
1033 return $services->getService( '_PageCommandFactory' );
1034 },
1035
1036 'MessageCache' => static function ( MediaWikiServices $services ): MessageCache {
1037 $mainConfig = $services->getMainConfig();
1038 $clusterCache = ObjectCache::getInstance( $mainConfig->get( MainConfigNames::MessageCacheType ) );
1039 $srvCache = $mainConfig->get( MainConfigNames::UseLocalMessageCache )
1040 ? $services->getLocalServerObjectCache()
1041 : new EmptyBagOStuff();
1042
1043 $logger = LoggerFactory::getInstance( 'MessageCache' );
1044 $logger->debug( 'MessageCache using store {class}', [
1045 'class' => get_class( $clusterCache )
1046 ] );
1047
1048 $options = new ServiceOptions( MessageCache::CONSTRUCTOR_OPTIONS, $mainConfig );
1049
1050 return new MessageCache(
1051 $services->getMainWANObjectCache(),
1052 $clusterCache,
1053 $srvCache,
1054 $services->getContentLanguage(),
1055 $services->getLanguageConverterFactory(),
1056 $logger,
1057 $options,
1058 $services->getLanguageFactory(),
1059 $services->getLocalisationCache(),
1060 $services->getLanguageNameUtils(),
1061 $services->getLanguageFallback(),
1062 $services->getHookContainer()
1063 );
1064 },
1065
1066 'MessageFormatterFactory' => static function ( MediaWikiServices $services ): IMessageFormatterFactory {
1068 },
1069
1070 'MetricsFactory' => static function ( MediaWikiServices $services ): MetricsFactory {
1071 $config = $services->getMainConfig();
1072 return new MetricsFactory(
1073 [
1074 'target' => $config->get( MainConfigNames::MetricsTarget ),
1075 'format' => $config->get( MainConfigNames::MetricsFormat ),
1076 'prefix' => $config->get( MainConfigNames::MetricsPrefix ),
1077 ],
1078 LoggerFactory::getInstance( 'Metrics' )
1079 );
1080 },
1081
1082 'MimeAnalyzer' => static function ( MediaWikiServices $services ): MimeAnalyzer {
1083 $logger = LoggerFactory::getInstance( 'Mime' );
1084 $mainConfig = $services->getMainConfig();
1085 $hookRunner = new HookRunner( $services->getHookContainer() );
1086 $params = [
1087 'typeFile' => $mainConfig->get( MainConfigNames::MimeTypeFile ),
1088 'infoFile' => $mainConfig->get( MainConfigNames::MimeInfoFile ),
1089 'xmlTypes' => $mainConfig->get( MainConfigNames::XMLMimeTypes ),
1090 'guessCallback' =>
1091 static function ( $mimeAnalyzer, &$head, &$tail, $file, &$mime )
1092 use ( $logger, $hookRunner ) {
1093 // Also test DjVu
1094 $deja = new DjVuImage( $file );
1095 if ( $deja->isValid() ) {
1096 $logger->info( "Detected $file as image/vnd.djvu\n" );
1097 $mime = 'image/vnd.djvu';
1098
1099 return;
1100 }
1101 // Some strings by reference for performance - assuming well-behaved hooks
1102 $hookRunner->onMimeMagicGuessFromContent(
1103 $mimeAnalyzer, $head, $tail, $file, $mime );
1104 },
1105 'extCallback' => static function ( $mimeAnalyzer, $ext, &$mime ) use ( $hookRunner ) {
1106 // Media handling extensions can improve the MIME detected
1107 $hookRunner->onMimeMagicImproveFromExtension( $mimeAnalyzer, $ext, $mime );
1108 },
1109 'initCallback' => static function ( $mimeAnalyzer ) use ( $hookRunner ) {
1110 // Allow media handling extensions adding MIME-types and MIME-info
1111 $hookRunner->onMimeMagicInit( $mimeAnalyzer );
1112 },
1113 'logger' => $logger
1114 ];
1115
1116 if ( $params['infoFile'] === 'includes/mime.info' ) {
1117 $params['infoFile'] = MimeAnalyzer::USE_INTERNAL;
1118 }
1119
1120 if ( $params['typeFile'] === 'includes/mime.types' ) {
1121 $params['typeFile'] = MimeAnalyzer::USE_INTERNAL;
1122 }
1123
1124 $detectorCmd = $mainConfig->get( MainConfigNames::MimeDetectorCommand );
1125 if ( $detectorCmd ) {
1126 $factory = $services->getShellCommandFactory();
1127 $params['detectCallback'] = static function ( $file ) use ( $detectorCmd, $factory ) {
1128 $result = $factory->create()
1129 // $wgMimeDetectorCommand can contain commands with parameters
1130 ->unsafeParams( $detectorCmd )
1131 ->params( $file )
1132 ->execute();
1133 return $result->getStdout();
1134 };
1135 }
1136
1137 return new MimeAnalyzer( $params );
1138 },
1139
1140 'MovePageFactory' => static function ( MediaWikiServices $services ): MovePageFactory {
1141 return $services->getService( '_PageCommandFactory' );
1142 },
1143
1144 'NamespaceInfo' => static function ( MediaWikiServices $services ): NamespaceInfo {
1146 new ServiceOptions( NamespaceInfo::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1147 $services->getHookContainer()
1148 );
1149 },
1150
1151 'NameTableStoreFactory' => static function ( MediaWikiServices $services ): NameTableStoreFactory {
1153 $services->getDBLoadBalancerFactory(),
1154 $services->getMainWANObjectCache(),
1155 LoggerFactory::getInstance( 'NameTableSqlStore' )
1156 );
1157 },
1158
1159 'ObjectFactory' => static function ( MediaWikiServices $services ): ObjectFactory {
1160 return new ObjectFactory( $services );
1161 },
1162
1163 'OldRevisionImporter' => static function ( MediaWikiServices $services ): OldRevisionImporter {
1165 true,
1166 LoggerFactory::getInstance( 'OldRevisionImporter' ),
1167 $services->getDBLoadBalancer(),
1168 $services->getRevisionStore(),
1169 $services->getSlotRoleRegistry(),
1170 $services->getWikiPageFactory(),
1171 $services->getPageUpdaterFactory(),
1172 $services->getUserFactory()
1173 );
1174 },
1175
1176 'PageEditStash' => static function ( MediaWikiServices $services ): PageEditStash {
1177 $config = $services->getMainConfig();
1178
1179 return new PageEditStash(
1180 ObjectCache::getLocalClusterInstance(),
1181 $services->getDBLoadBalancer(),
1182 LoggerFactory::getInstance( 'StashEdit' ),
1183 $services->getStatsdDataFactory(),
1184 $services->getUserEditTracker(),
1185 $services->getUserFactory(),
1186 $services->getWikiPageFactory(),
1187 $services->getHookContainer(),
1188 defined( 'MEDIAWIKI_JOB_RUNNER' ) || $GLOBALS[ 'wgCommandLineMode' ]
1189 ? PageEditStash::INITIATOR_JOB_OR_CLI
1190 : PageEditStash::INITIATOR_USER
1191 );
1192 },
1193
1194 'PageProps' => static function ( MediaWikiServices $services ): PageProps {
1195 return new PageProps(
1196 $services->getLinkBatchFactory(),
1197 $services->getDBLoadBalancer()
1198 );
1199 },
1200
1201 'PageStore' => static function ( MediaWikiServices $services ): PageStore {
1202 return $services->getPageStoreFactory()->getPageStore();
1203 },
1204
1205 'PageStoreFactory' => static function ( MediaWikiServices $services ): PageStoreFactory {
1206 $options = new ServiceOptions(
1207 PageStoreFactory::CONSTRUCTOR_OPTIONS,
1208 $services->getMainConfig()
1209 );
1210
1211 return new PageStoreFactory(
1212 $options,
1213 $services->getDBLoadBalancerFactory(),
1214 $services->getNamespaceInfo(),
1215 $services->getTitleParser(),
1216 $services->getLinkCache(),
1217 $services->getStatsdDataFactory()
1218 );
1219 },
1220
1221 'PageUpdaterFactory' => static function (
1222 MediaWikiServices $services
1224 $editResultCache = new EditResultCache(
1225 $services->getMainObjectStash(),
1226 $services->getDBLoadBalancer(),
1227 new ServiceOptions(
1228 EditResultCache::CONSTRUCTOR_OPTIONS,
1229 $services->getMainConfig()
1230 )
1231 );
1232
1233 return new PageUpdaterFactory(
1234 $services->getRevisionStore(),
1235 $services->getRevisionRenderer(),
1236 $services->getSlotRoleRegistry(),
1237 $services->getParserCache(),
1238 $services->getParsoidOutputAccess(),
1239 $services->getJobQueueGroup(),
1240 $services->getMessageCache(),
1241 $services->getContentLanguage(),
1242 $services->getDBLoadBalancerFactory(),
1243 $services->getContentHandlerFactory(),
1244 $services->getHookContainer(),
1245 $editResultCache,
1246 $services->getUserNameUtils(),
1247 LoggerFactory::getInstance( 'SavePage' ),
1248 new ServiceOptions(
1249 PageUpdaterFactory::CONSTRUCTOR_OPTIONS,
1250 $services->getMainConfig()
1251 ),
1252 $services->getUserEditTracker(),
1253 $services->getUserGroupManager(),
1254 $services->getTitleFormatter(),
1255 $services->getContentTransformer(),
1256 $services->getPageEditStash(),
1257 $services->getTalkPageNotificationManager(),
1258 $services->getMainWANObjectCache(),
1259 $services->getPermissionManager(),
1260 $services->getWikiPageFactory(),
1262 );
1263 },
1264
1265 'Parser' => static function ( MediaWikiServices $services ): Parser {
1266 return $services->getParserFactory()->getMainInstance();
1267 },
1268
1269 'ParserCache' => static function ( MediaWikiServices $services ): ParserCache {
1270 return $services->getParserCacheFactory()
1271 ->getParserCache( ParserCacheFactory::DEFAULT_NAME );
1272 },
1273
1274 'ParserCacheFactory' => static function ( MediaWikiServices $services ): ParserCacheFactory {
1275 $config = $services->getMainConfig();
1276 $cache = ObjectCache::getInstance( $config->get( MainConfigNames::ParserCacheType ) );
1277 $wanCache = $services->getMainWANObjectCache();
1278
1279 $options = new ServiceOptions( ParserCacheFactory::CONSTRUCTOR_OPTIONS, $config );
1280
1281 return new ParserCacheFactory(
1282 $cache,
1283 $wanCache,
1284 $services->getHookContainer(),
1285 $services->getJsonCodec(),
1286 $services->getStatsdDataFactory(),
1287 LoggerFactory::getInstance( 'ParserCache' ),
1288 $options,
1289 $services->getTitleFactory(),
1290 $services->getWikiPageFactory()
1291 );
1292 },
1293
1294 'ParserFactory' => static function ( MediaWikiServices $services ): ParserFactory {
1295 $options = new ServiceOptions( Parser::CONSTRUCTOR_OPTIONS,
1296 $services->getMainConfig()
1297 );
1298
1299 return new ParserFactory(
1300 $options,
1301 $services->getMagicWordFactory(),
1302 $services->getContentLanguage(),
1303 $services->getUrlUtils(),
1304 $services->getSpecialPageFactory(),
1305 $services->getLinkRendererFactory(),
1306 $services->getNamespaceInfo(),
1307 LoggerFactory::getInstance( 'Parser' ),
1308 $services->getBadFileLookup(),
1309 $services->getLanguageConverterFactory(),
1310 $services->getHookContainer(),
1311 $services->getTidy(),
1312 $services->getMainWANObjectCache(),
1313 $services->getUserOptionsLookup(),
1314 $services->getUserFactory(),
1315 $services->getTitleFormatter(),
1316 $services->getHttpRequestFactory(),
1317 $services->getTrackingCategories(),
1318 $services->getSignatureValidatorFactory(),
1319 $services->getUserNameUtils()
1320 );
1321 },
1322
1323 'ParserOutputAccess' => static function ( MediaWikiServices $services ): ParserOutputAccess {
1325 $services->getParserCache(),
1326 $services->getParserCacheFactory()->getRevisionOutputCache( 'rcache' ),
1327 $services->getRevisionLookup(),
1328 $services->getRevisionRenderer(),
1329 $services->getStatsdDataFactory(),
1330 $services->getDBLoadBalancerFactory(),
1331 LoggerFactory::getProvider(),
1332 $services->getWikiPageFactory(),
1333 $services->getTitleFormatter()
1334 );
1335 },
1336
1337 'ParsoidDataAccess' => static function ( MediaWikiServices $services ): DataAccess {
1338 $mainConfig = $services->getMainConfig();
1339 $parsoidSettings = $mainConfig->get( MainConfigNames::ParsoidSettings );
1340 if ( !empty( $parsoidSettings['debugApi'] ) ) {
1341 return ApiDataAccess::fromSettings( $parsoidSettings );
1342 }
1343 return new MWDataAccess(
1345 $services->getRepoGroup(),
1346 $services->getBadFileLookup(),
1347 $services->getHookContainer(),
1348 $services->getContentTransformer(),
1349 $services->getReadOnlyMode(),
1350 $services->getParserFactory() // *legacy* parser factory
1351 );
1352 },
1353
1354 'ParsoidOutputAccess' => static function ( MediaWikiServices $services ): ParsoidOutputAccess {
1356 new ServiceOptions(
1357 ParsoidOutputAccess::CONSTRUCTOR_OPTIONS,
1358 $services->getMainConfig()
1359 ),
1360 $services->getParserCacheFactory(),
1361 $services->getRevisionLookup(),
1362 $services->getGlobalIdGenerator(),
1363 $services->getStatsdDataFactory(),
1364 $services->getService( '_Parsoid' ),
1365 $services->getParsoidSiteConfig(),
1366 $services->getParsoidPageConfigFactory()
1367 );
1368 },
1369
1370 'ParsoidOutputStash' => static function ( MediaWikiServices $services ): ParsoidOutputStash {
1371 // TODO: Determine storage requirements and config options for stashing parsoid
1372 // output for VE edits (T309016).
1373 $config = $services->getMainConfig()->get( MainConfigNames::ParsoidCacheConfig );
1374 $backend = $config['StashType']
1375 ? ObjectCache::getInstance( $config['StashType'] )
1376 : $services->getMainObjectStash();
1377
1378 return new SimpleParsoidOutputStash( $backend, $config['StashDuration'] );
1379 },
1380
1381 'ParsoidPageConfigFactory' => static function ( MediaWikiServices $services ): MWPageConfigFactory {
1382 return new MWPageConfigFactory( $services->getRevisionStore(),
1383 $services->getSlotRoleRegistry() );
1384 },
1385
1386 'ParsoidSiteConfig' => static function ( MediaWikiServices $services ): SiteConfig {
1387 $mainConfig = $services->getMainConfig();
1388 $parsoidSettings = $mainConfig->get( MainConfigNames::ParsoidSettings );
1389 if ( !empty( $parsoidSettings['debugApi'] ) ) {
1390 return ApiSiteConfig::fromSettings( $parsoidSettings );
1391 }
1392 return new MWSiteConfig(
1394 $parsoidSettings,
1395 $services->getObjectFactory(),
1396 $services->getContentLanguage(),
1397 $services->getStatsdDataFactory(),
1398 $services->getMagicWordFactory(),
1399 $services->getNamespaceInfo(),
1400 $services->getSpecialPageFactory(),
1401 $services->getInterwikiLookup(),
1402 $services->getUserOptionsLookup(),
1403 $services->getLanguageFactory(),
1404 $services->getLanguageConverterFactory(),
1405 $services->getLanguageNameUtils(),
1406 $services->getUrlUtils(),
1407 // These arguments are temporary and will be removed once
1408 // better solutions are found.
1409 $services->getParser(), // T268776
1410 $mainConfig // T268777
1411 );
1412 },
1413
1414 'PasswordFactory' => static function ( MediaWikiServices $services ): PasswordFactory {
1415 $config = $services->getMainConfig();
1416 return new PasswordFactory(
1417 $config->get( MainConfigNames::PasswordConfig ),
1418 $config->get( MainConfigNames::PasswordDefault )
1419 );
1420 },
1421
1422 'PasswordReset' => static function ( MediaWikiServices $services ): PasswordReset {
1423 $options = new ServiceOptions( PasswordReset::CONSTRUCTOR_OPTIONS, $services->getMainConfig() );
1424 return new PasswordReset(
1425 $options,
1426 LoggerFactory::getInstance( 'authentication' ),
1427 $services->getAuthManager(),
1428 $services->getHookContainer(),
1429 $services->getDBLoadBalancer(),
1430 $services->getUserFactory(),
1431 $services->getUserNameUtils(),
1432 $services->getUserOptionsLookup()
1433 );
1434 },
1435
1436 'PerDbNameStatsdDataFactory' =>
1437 static function ( MediaWikiServices $services ): StatsdDataFactoryInterface {
1438 $config = $services->getMainConfig();
1439 $wiki = $config->get( MainConfigNames::DBname );
1441 $services->getStatsdDataFactory(),
1442 $wiki
1443 );
1444 },
1445
1446 'PermissionManager' => static function ( MediaWikiServices $services ): PermissionManager {
1448 new ServiceOptions(
1449 PermissionManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1450 ),
1451 $services->getSpecialPageFactory(),
1452 $services->getNamespaceInfo(),
1453 $services->getGroupPermissionsLookup(),
1454 $services->getUserGroupManager(),
1455 $services->getBlockErrorFormatter(),
1456 $services->getHookContainer(),
1457 $services->getUserCache(),
1458 $services->getRedirectLookup(),
1459 $services->getRestrictionStore(),
1460 $services->getTitleFormatter(),
1461 $services->getTempUserConfig(),
1462 $services->getUserFactory(),
1463 $services->getActionFactory()
1464 );
1465 },
1466
1467 'PreferencesFactory' => static function ( MediaWikiServices $services ): PreferencesFactory {
1468 $factory = new DefaultPreferencesFactory(
1469 new ServiceOptions(
1470 DefaultPreferencesFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1471 $services->getContentLanguage(),
1472 $services->getAuthManager(),
1473 $services->getLinkRendererFactory()->create(),
1474 $services->getNamespaceInfo(),
1475 $services->getPermissionManager(),
1476 $services->getLanguageConverterFactory()->getLanguageConverter(),
1477 $services->getLanguageNameUtils(),
1478 $services->getHookContainer(),
1479 $services->getUserOptionsManager(),
1480 $services->getLanguageConverterFactory(),
1481 $services->getParser(),
1482 $services->getSkinFactory(),
1483 $services->getUserGroupManager(),
1484 $services->getSignatureValidatorFactory()
1485 );
1486 $factory->setLogger( LoggerFactory::getInstance( 'preferences' ) );
1487
1488 return $factory;
1489 },
1490
1491 'ProxyLookup' => static function ( MediaWikiServices $services ): ProxyLookup {
1492 $mainConfig = $services->getMainConfig();
1493 return new ProxyLookup(
1494 $mainConfig->get( MainConfigNames::CdnServers ),
1495 $mainConfig->get( MainConfigNames::CdnServersNoPurge ),
1496 $services->getHookContainer()
1497 );
1498 },
1499
1500 'RateLimiter' => static function ( MediaWikiServices $services ): RateLimiter {
1501 return new RateLimiter(
1502 new ServiceOptions( RateLimiter::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1503 $services->getWRStatsFactory(),
1504 $services->getCentralIdLookupFactory()->getNonLocalLookup(),
1505 $services->getUserFactory(),
1506 $services->getUserGroupManager(),
1507 $services->getHookContainer()
1508 );
1509 },
1510
1511 'ReadOnlyMode' => static function ( MediaWikiServices $services ): ReadOnlyMode {
1512 return new ReadOnlyMode(
1513 $services->getConfiguredReadOnlyMode(),
1514 $services->getDBLoadBalancer()
1515 );
1516 },
1517
1518 'RedirectLookup' => static function ( MediaWikiServices $services ): RedirectLookup {
1519 return $services->getRedirectStore();
1520 },
1521
1522 'RedirectStore' => static function ( MediaWikiServices $services ): RedirectStore {
1523 return new RedirectStore( $services->getWikiPageFactory() );
1524 },
1525
1526 'RepoGroup' => static function ( MediaWikiServices $services ): RepoGroup {
1527 $config = $services->getMainConfig();
1528 return new RepoGroup(
1529 $config->get( MainConfigNames::LocalFileRepo ),
1530 $config->get( MainConfigNames::ForeignFileRepos ),
1531 $services->getMainWANObjectCache(),
1532 $services->getMimeAnalyzer()
1533 );
1534 },
1535
1536 'ResourceLoader' => static function ( MediaWikiServices $services ): ResourceLoader {
1537 $config = $services->getMainConfig();
1538
1539 $maxage = $config->get( MainConfigNames::ResourceLoaderMaxage );
1540 $rl = new ResourceLoader(
1541 $config,
1542 LoggerFactory::getInstance( 'resourceloader' ),
1543 $config->get( MainConfigNames::ResourceLoaderUseObjectCacheForDeps )
1544 ? new KeyValueDependencyStore( $services->getMainObjectStash() )
1545 : new SqlModuleDependencyStore( $services->getDBLoadBalancer() ),
1546 [
1547 'loadScript' => $config->get( MainConfigNames::LoadScript ),
1548 'maxageVersioned' => $maxage['versioned'] ?? null,
1549 'maxageUnversioned' => $maxage['unversioned'] ?? null,
1550 'useFileCache' => $config->get( MainConfigNames::UseFileCache ),
1551 ]
1552 );
1553
1554 $extRegistry = ExtensionRegistry::getInstance();
1555 // Attribute has precedence over config
1556 $modules = $extRegistry->getAttribute( 'ResourceModules' )
1557 + $config->get( MainConfigNames::ResourceModules );
1558 $moduleSkinStyles = $extRegistry->getAttribute( 'ResourceModuleSkinStyles' )
1559 + $config->get( MainConfigNames::ResourceModuleSkinStyles );
1560
1561 $rl->setModuleSkinStyles( $moduleSkinStyles );
1562 $rl->addSource( $config->get( MainConfigNames::ResourceLoaderSources ) );
1563
1564 // Core modules, then extension/skin modules
1565 $baseDir = $config->get( MainConfigNames::BaseDirectory );
1566 $rl->register( include "$baseDir/resources/Resources.php" );
1567 $rl->register( $modules );
1568 $hookRunner = new \MediaWiki\ResourceLoader\HookRunner( $services->getHookContainer() );
1569 $hookRunner->onResourceLoaderRegisterModules( $rl );
1570
1571 $msgPosterAttrib = $extRegistry->getAttribute( 'MessagePosterModule' );
1572 $rl->register( 'mediawiki.messagePoster', [
1573 'localBasePath' => $baseDir,
1574 'debugRaw' => false,
1575 'scripts' => array_merge(
1576 [
1577 "resources/src/mediawiki.messagePoster/factory.js",
1578 "resources/src/mediawiki.messagePoster/MessagePoster.js",
1579 "resources/src/mediawiki.messagePoster/WikitextMessagePoster.js",
1580 ],
1581 $msgPosterAttrib['scripts'] ?? []
1582 ),
1583 'dependencies' => array_merge(
1584 [
1585 'oojs',
1586 'mediawiki.api',
1587 'mediawiki.ForeignApi',
1588 ],
1589 $msgPosterAttrib['dependencies'] ?? []
1590 ),
1591 'targets' => [ 'desktop', 'mobile' ],
1592 ] );
1593
1594 if ( $config->get( MainConfigNames::EnableJavaScriptTest ) === true ) {
1595 $rl->registerTestModules();
1596 }
1597
1598 return $rl;
1599 },
1600
1601 'RestrictionStore' => static function ( MediaWikiServices $services ): RestrictionStore {
1603 new ServiceOptions(
1604 RestrictionStore::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1605 ),
1606 $services->getMainWANObjectCache(),
1607 $services->getDBLoadBalancer(),
1608 $services->getLinkCache(),
1609 $services->getLinksMigration(),
1610 $services->getCommentStore(),
1611 $services->getHookContainer(),
1612 $services->getPageStore()
1613 );
1614 },
1615
1616 'RevertedTagUpdateManager' => static function ( MediaWikiServices $services ): RevertedTagUpdateManager {
1617 $editResultCache = new EditResultCache(
1618 $services->getMainObjectStash(),
1619 $services->getDBLoadBalancer(),
1620 new ServiceOptions(
1621 EditResultCache::CONSTRUCTOR_OPTIONS,
1622 $services->getMainConfig()
1623 )
1624 );
1625
1626 return new RevertedTagUpdateManager(
1627 $editResultCache,
1628 $services->getJobQueueGroup()
1629 );
1630 },
1631
1632 'RevisionFactory' => static function ( MediaWikiServices $services ): RevisionFactory {
1633 return $services->getRevisionStore();
1634 },
1635
1636 'RevisionLookup' => static function ( MediaWikiServices $services ): RevisionLookup {
1637 return $services->getRevisionStore();
1638 },
1639
1640 'RevisionRenderer' => static function ( MediaWikiServices $services ): RevisionRenderer {
1641 $renderer = new RevisionRenderer(
1642 $services->getDBLoadBalancer(),
1643 $services->getSlotRoleRegistry(),
1644 $services->getContentRenderer()
1645 );
1646
1647 $renderer->setLogger( LoggerFactory::getInstance( 'SaveParse' ) );
1648 return $renderer;
1649 },
1650
1651 'RevisionStore' => static function ( MediaWikiServices $services ): RevisionStore {
1652 return $services->getRevisionStoreFactory()->getRevisionStore();
1653 },
1654
1655 'RevisionStoreFactory' => static function ( MediaWikiServices $services ): RevisionStoreFactory {
1657 $services->getDBLoadBalancerFactory(),
1658 $services->getBlobStoreFactory(),
1659 $services->getNameTableStoreFactory(),
1660 $services->getSlotRoleRegistry(),
1661 $services->getMainWANObjectCache(),
1662 $services->getLocalServerObjectCache(),
1663 $services->getCommentStore(),
1664 $services->getActorMigration(),
1665 $services->getActorStoreFactory(),
1666 LoggerFactory::getInstance( 'RevisionStore' ),
1667 $services->getContentHandlerFactory(),
1668 $services->getPageStoreFactory(),
1669 $services->getTitleFactory(),
1670 $services->getHookContainer()
1671 );
1672 },
1673
1674 'RollbackPageFactory' => static function ( MediaWikiServices $services ): RollbackPageFactory {
1675 return $services->get( '_PageCommandFactory' );
1676 },
1677
1678 'RowCommentFormatter' => static function ( MediaWikiServices $services ): RowCommentFormatter {
1679 $parserFactory = new CommentParserFactory(
1680 $services->getLinkRenderer(),
1681 $services->getLinkBatchFactory(),
1682 $services->getLinkCache(),
1683 $services->getRepoGroup(),
1684 RequestContext::getMain()->getLanguage(),
1685 $services->getContentLanguage(),
1686 $services->getTitleParser(),
1687 $services->getNamespaceInfo(),
1688 $services->getHookContainer()
1689 );
1690 return new RowCommentFormatter(
1691 $parserFactory,
1692 $services->getCommentStore()
1693 );
1694 },
1695
1696 'SearchEngineConfig' => static function ( MediaWikiServices $services ): SearchEngineConfig {
1697 // @todo This should not take a Config object, but it's not so easy to remove because it
1698 // exposes it in a getter, which is actually used.
1700 $services->getMainConfig(),
1701 $services->getContentLanguage(),
1702 $services->getHookContainer(),
1703 ExtensionRegistry::getInstance()->getAttribute( 'SearchMappings' ),
1704 $services->getUserOptionsLookup()
1705 );
1706 },
1707
1708 'SearchEngineFactory' => static function ( MediaWikiServices $services ): SearchEngineFactory {
1710 $services->getSearchEngineConfig(),
1711 $services->getHookContainer(),
1712 $services->getDBLoadBalancer()
1713 );
1714 },
1715
1716 'ShellboxClientFactory' => static function ( MediaWikiServices $services ): ShellboxClientFactory {
1717 $urls = $services->getMainConfig()->get( MainConfigNames::ShellboxUrls );
1718 // TODO: Remove this logic and $wgShellboxUrl configuration in 1.38
1719 $url = $services->getMainConfig()->get( MainConfigNames::ShellboxUrl );
1720 if ( $url !== null ) {
1721 $urls['default'] = $url;
1722 }
1723 return new ShellboxClientFactory(
1724 $services->getHttpRequestFactory(),
1725 $urls,
1726 $services->getMainConfig()->get( MainConfigNames::ShellboxSecretKey )
1727 );
1728 },
1729
1730 'ShellCommandFactory' => static function ( MediaWikiServices $services ): CommandFactory {
1731 $config = $services->getMainConfig();
1732
1733 $limits = [
1734 'time' => $config->get( MainConfigNames::MaxShellTime ),
1735 'walltime' => $config->get( MainConfigNames::MaxShellWallClockTime ),
1736 'memory' => $config->get( MainConfigNames::MaxShellMemory ),
1737 'filesize' => $config->get( MainConfigNames::MaxShellFileSize ),
1738 ];
1739 $cgroup = $config->get( MainConfigNames::ShellCgroup );
1740 $restrictionMethod = $config->get( MainConfigNames::ShellRestrictionMethod );
1741
1742 $factory = new CommandFactory( $services->getShellboxClientFactory(),
1743 $limits, $cgroup, $restrictionMethod );
1744 $factory->setLogger( LoggerFactory::getInstance( 'exec' ) );
1745 $factory->logStderr();
1746
1747 return $factory;
1748 },
1749
1750 'SignatureValidatorFactory' => static function ( MediaWikiServices $services ): SignatureValidatorFactory {
1752 new ServiceOptions(
1753 SignatureValidator::CONSTRUCTOR_OPTIONS,
1754 $services->getMainConfig()
1755 ),
1756 // Use a closure for ParserFactory to avoid a circular dependency
1757 static function () use ( $services ) {
1758 return $services->getParserFactory();
1759 },
1760 $services->getSpecialPageFactory(),
1761 $services->getTitleFactory()
1762 );
1763 },
1764
1765 'SiteLookup' => static function ( MediaWikiServices $services ): SiteLookup {
1766 // Use SiteStore as the SiteLookup as well. This was originally separated
1767 // to allow for a cacheable read-only interface, but this was never used.
1768 // SiteStore has caching (see below).
1769 return $services->getSiteStore();
1770 },
1771
1772 'SiteStore' => static function ( MediaWikiServices $services ): SiteStore {
1773 $rawSiteStore = new DBSiteStore( $services->getDBLoadBalancer() );
1774
1775 $cache = $services->getLocalServerObjectCache();
1776 if ( $cache instanceof EmptyBagOStuff ) {
1778 }
1779
1780 return new CachingSiteStore( $rawSiteStore, $cache );
1781 },
1782
1784 'SkinFactory' => static function ( MediaWikiServices $services ): SkinFactory {
1785 $factory = new SkinFactory(
1786 $services->getObjectFactory(),
1787 (array)$services->getMainConfig()->get( MainConfigNames::SkipSkins )
1788 );
1789
1790 $names = $services->getMainConfig()->get( MainConfigNames::ValidSkinNames );
1791
1792 foreach ( $names as $name => $skin ) {
1793 if ( is_array( $skin ) ) {
1794 $spec = $skin;
1795 $displayName = $skin['displayname'] ?? $name;
1796 $skippable = $skin['skippable'] ?? null;
1797 } else {
1798 $displayName = $skin;
1799 $skippable = null;
1800 $spec = [
1801 'name' => $name,
1802 'class' => "Skin$skin"
1803 ];
1804 }
1805 $factory->register( $name, $displayName, $spec, $skippable );
1806 }
1807
1808 // Register a hidden "fallback" skin
1809 $factory->register( 'fallback', 'Fallback', [
1810 'class' => SkinFallback::class,
1811 'args' => [
1812 [
1813 'name' => 'fallback',
1814 'styles' => [ 'mediawiki.skinning.interface' ],
1815 'templateDirectory' => __DIR__ . '/skins/templates/fallback',
1816 ]
1817 ]
1818 ], true );
1819 // Register a hidden skin for api output
1820 $factory->register( 'apioutput', 'ApiOutput', [
1821 'class' => SkinApi::class,
1822 'args' => [
1823 [
1824 'name' => 'apioutput',
1825 'styles' => [ 'mediawiki.skinning.interface' ],
1826 'templateDirectory' => __DIR__ . '/skins/templates/apioutput',
1827 ]
1828 ]
1829 ], true );
1830
1831 return $factory;
1832 },
1833
1834 'SlotRoleRegistry' => static function ( MediaWikiServices $services ): SlotRoleRegistry {
1835 $registry = new SlotRoleRegistry(
1836 $services->getSlotRoleStore()
1837 );
1838
1839 $config = $services->getMainConfig();
1840 $contentHandlerFactory = $services->getContentHandlerFactory();
1841 $hookContainer = $services->getHookContainer();
1842 $titleFactory = $services->getTitleFactory();
1843 $registry->defineRole(
1844 'main',
1845 static function () use ( $config, $contentHandlerFactory, $hookContainer, $titleFactory ) {
1846 return new MainSlotRoleHandler(
1847 $config->get( MainConfigNames::NamespaceContentModels ),
1848 $contentHandlerFactory,
1849 $hookContainer,
1850 $titleFactory
1851 );
1852 }
1853 );
1854
1855 return $registry;
1856 },
1857
1858 'SlotRoleStore' => static function ( MediaWikiServices $services ): NameTableStore {
1859 return $services->getNameTableStoreFactory()->getSlotRoles();
1860 },
1861
1862 'SpamChecker' => static function ( MediaWikiServices $services ): SpamChecker {
1863 return new SpamChecker(
1864 (array)$services->getMainConfig()->get( MainConfigNames::SpamRegex ),
1865 (array)$services->getMainConfig()->get( MainConfigNames::SummarySpamRegex )
1866 );
1867 },
1868
1869 'SpecialPageFactory' => static function ( MediaWikiServices $services ): SpecialPageFactory {
1871 new ServiceOptions(
1872 SpecialPageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1873 $services->getContentLanguage(),
1874 $services->getObjectFactory(),
1875 $services->getTitleFactory(),
1876 $services->getHookContainer()
1877 );
1878 },
1879
1880 'StatsdDataFactory' => static function ( MediaWikiServices $services ): IBufferingStatsdDataFactory {
1882 rtrim( $services->getMainConfig()->get( MainConfigNames::StatsdMetricPrefix ), '.' )
1883 );
1884 },
1885
1886 'TalkPageNotificationManager' => static function (
1887 MediaWikiServices $services
1890 new ServiceOptions(
1891 TalkPageNotificationManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1892 ),
1893 $services->getDBLoadBalancer(),
1894 $services->getReadOnlyMode(),
1895 $services->getRevisionLookup(),
1896 $services->getHookContainer(),
1897 $services->getUserFactory()
1898 );
1899 },
1900
1901 'TempFSFileFactory' => static function ( MediaWikiServices $services ): TempFSFileFactory {
1902 return new TempFSFileFactory( $services->getMainConfig()->get( MainConfigNames::TmpDirectory ) );
1903 },
1904
1905 'TempUserConfig' => static function ( MediaWikiServices $services ): RealTempUserConfig {
1907 $services->getMainConfig()->get( MainConfigNames::AutoCreateTempUser )
1908 );
1909 },
1910
1911 'TempUserCreator' => static function ( MediaWikiServices $services ): TempUserCreator {
1912 $accountCreationThrottle = $services->getMainConfig()->get( MainConfigNames::AccountCreationThrottle );
1913 // T306878: Handle old $wgAccountCreationThrottle format (number of attempts per 24 hours)
1914 if ( !is_array( $accountCreationThrottle ) ) {
1915 $accountCreationThrottle = [ [
1916 'count' => $accountCreationThrottle,
1917 'seconds' => 86400,
1918 ] ];
1919 }
1920
1921 return new TempUserCreator(
1922 $services->getTempUserConfig(),
1923 $services->getObjectFactory(),
1924 $services->getUserFactory(),
1925 $services->getAuthManager(),
1926 // This is supposed to match ThrottlePreAuthenticationProvider
1927 new Throttler(
1928 $accountCreationThrottle,
1929 [
1930 'type' => 'acctcreate',
1931 'cache' => $services->getLocalServerObjectCache()
1932 ]
1933 )
1934 );
1935 },
1936
1937 'Tidy' => static function ( MediaWikiServices $services ): TidyDriverBase {
1938 return new RemexDriver(
1939 new ServiceOptions(
1940 RemexDriver::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1941 )
1942 );
1943 },
1944
1945 'TitleFactory' => static function ( MediaWikiServices $services ): TitleFactory {
1946 return new TitleFactory();
1947 },
1948
1949 'TitleFormatter' => static function ( MediaWikiServices $services ): TitleFormatter {
1950 return $services->getService( '_MediaWikiTitleCodec' );
1951 },
1952
1953 'TitleParser' => static function ( MediaWikiServices $services ): TitleParser {
1954 return $services->getService( '_MediaWikiTitleCodec' );
1955 },
1956
1957 'TrackingCategories' => static function ( MediaWikiServices $services ): TrackingCategories {
1959 new ServiceOptions(
1960 TrackingCategories::CONSTRUCTOR_OPTIONS,
1961 $services->getMainConfig()
1962 ),
1963 $services->getNamespaceInfo(),
1964 $services->getTitleParser(),
1965 LoggerFactory::getInstance( 'TrackingCategories' )
1966 );
1967 },
1968
1969 'UnblockUserFactory' => static function ( MediaWikiServices $services ): UnblockUserFactory {
1970 return $services->getService( '_UserBlockCommandFactory' );
1971 },
1972
1973 'UndeletePageFactory' => static function ( MediaWikiServices $services ): UndeletePageFactory {
1974 return $services->getService( '_PageCommandFactory' );
1975 },
1976
1977 'UploadRevisionImporter' => static function ( MediaWikiServices $services ): UploadRevisionImporter {
1979 $services->getMainConfig()->get( MainConfigNames::EnableUploads ),
1980 LoggerFactory::getInstance( 'UploadRevisionImporter' )
1981 );
1982 },
1983
1984 'UrlUtils' => static function ( MediaWikiServices $services ): UrlUtils {
1985 $config = $services->getMainConfig();
1986 return new UrlUtils( [
1987 UrlUtils::SERVER => $config->get( MainConfigNames::Server ),
1988 UrlUtils::CANONICAL_SERVER => $config->get( MainConfigNames::CanonicalServer ),
1989 UrlUtils::INTERNAL_SERVER => $config->get( MainConfigNames::InternalServer ),
1990 UrlUtils::FALLBACK_PROTOCOL => RequestContext::getMain()->getRequest()->getProtocol(),
1991 UrlUtils::HTTPS_PORT => $config->get( MainConfigNames::HttpsPort ),
1992 UrlUtils::VALID_PROTOCOLS => $config->get( MainConfigNames::UrlProtocols ),
1993 ] );
1994 },
1995
1996 'UserCache' => static function ( MediaWikiServices $services ): UserCache {
1997 return new UserCache(
1998 LoggerFactory::getInstance( 'UserCache' ),
1999 $services->getDBLoadBalancer(),
2000 $services->getLinkBatchFactory()
2001 );
2002 },
2003
2004 'UserEditTracker' => static function ( MediaWikiServices $services ): UserEditTracker {
2006 $services->getActorMigration(),
2007 $services->getDBLoadBalancer(),
2008 $services->getJobQueueGroup()
2009 );
2010 },
2011
2012 'UserFactory' => static function ( MediaWikiServices $services ): UserFactory {
2013 return new UserFactory(
2014 $services->getDBLoadBalancer(),
2015 $services->getUserNameUtils()
2016 );
2017 },
2018
2019 'UserGroupManager' => static function ( MediaWikiServices $services ): UserGroupManager {
2020 return $services->getUserGroupManagerFactory()->getUserGroupManager();
2021 },
2022
2023 'UserGroupManagerFactory' => static function ( MediaWikiServices $services ): UserGroupManagerFactory {
2025 new ServiceOptions(
2026 UserGroupManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
2027 ),
2028 $services->getConfiguredReadOnlyMode(),
2029 $services->getDBLoadBalancerFactory(),
2030 $services->getHookContainer(),
2031 $services->getUserEditTracker(),
2032 $services->getGroupPermissionsLookup(),
2033 $services->getJobQueueGroupFactory(),
2034 LoggerFactory::getInstance( 'UserGroupManager' ),
2035 $services->getTempUserConfig(),
2036 [ static function ( UserIdentity $user ) use ( $services ) {
2037 $services->getPermissionManager()->invalidateUsersRightsCache( $user );
2038 $services->getUserFactory()->newFromUserIdentity( $user )->invalidateCache();
2039 } ]
2040 );
2041 },
2042
2043 'UserIdentityLookup' => static function ( MediaWikiServices $services ): UserIdentityLookup {
2044 return $services->getActorStoreFactory()->getUserIdentityLookup();
2045 },
2046
2047 'UserNamePrefixSearch' => static function ( MediaWikiServices $services ): UserNamePrefixSearch {
2049 $services->getDBLoadBalancer(),
2050 $services->getUserNameUtils()
2051 );
2052 },
2053
2054 'UserNameUtils' => static function ( MediaWikiServices $services ): UserNameUtils {
2055 $messageFormatterFactory = new MessageFormatterFactory( Message::FORMAT_PLAIN );
2056 return new UserNameUtils(
2057 new ServiceOptions(
2058 UserNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
2059 ),
2060 $services->getContentLanguage(),
2061 LoggerFactory::getInstance( 'UserNameUtils' ),
2062 $services->getTitleParser(),
2063 $messageFormatterFactory->getTextFormatter(
2064 $services->getContentLanguage()->getCode()
2065 ),
2066 $services->getHookContainer(),
2067 $services->getTempUserConfig()
2068 );
2069 },
2070
2071 'UserOptionsLookup' => static function ( MediaWikiServices $services ): UserOptionsLookup {
2072 return $services->getUserOptionsManager();
2073 },
2074
2075 'UserOptionsManager' => static function ( MediaWikiServices $services ): UserOptionsManager {
2077 new ServiceOptions( UserOptionsManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
2078 $services->get( '_DefaultOptionsLookup' ),
2079 $services->getLanguageConverterFactory(),
2080 $services->getDBLoadBalancer(),
2081 LoggerFactory::getInstance( 'UserOptionsManager' ),
2082 $services->getHookContainer(),
2083 $services->getUserFactory(),
2084 $services->getContentLanguage()
2085 );
2086 },
2087
2088 'VirtualRESTServiceClient' =>
2089 static function ( MediaWikiServices $services ): VirtualRESTServiceClient {
2090 $config = $services->getMainConfig()->get( MainConfigNames::VirtualRestConfig );
2091
2092 $vrsClient = new VirtualRESTServiceClient(
2093 $services->getHttpRequestFactory()->createMultiClient() );
2094 foreach ( $config['paths'] as $prefix => $serviceConfig ) {
2095 $class = $serviceConfig['class'];
2096 // Merge in the global defaults
2097 $constructArg = $serviceConfig['options'] ?? [];
2098 $constructArg += $config['global'];
2099 // Make the VRS service available at the mount point
2100 $vrsClient->mount( $prefix, [ 'class' => $class, 'config' => $constructArg ] );
2101 }
2102
2103 return $vrsClient;
2104 },
2105
2106 'WatchedItemQueryService' =>
2107 static function ( MediaWikiServices $services ): WatchedItemQueryService {
2109 $services->getDBLoadBalancer(),
2110 $services->getCommentStore(),
2111 $services->getWatchedItemStore(),
2112 $services->getHookContainer(),
2113 $services->getUserOptionsLookup(),
2114 $services->getMainConfig()->get( MainConfigNames::WatchlistExpiry ),
2115 $services->getMainConfig()->get( MainConfigNames::MaxExecutionTimeForExpensiveQueries )
2116 );
2117 },
2118
2119 'WatchedItemStore' => static function ( MediaWikiServices $services ): WatchedItemStore {
2120 $store = new WatchedItemStore(
2121 new ServiceOptions( WatchedItemStore::CONSTRUCTOR_OPTIONS,
2122 $services->getMainConfig() ),
2123 $services->getDBLoadBalancerFactory(),
2124 $services->getJobQueueGroup(),
2125 $services->getMainObjectStash(),
2126 new HashBagOStuff( [ 'maxKeys' => 100 ] ),
2127 $services->getReadOnlyMode(),
2128 $services->getNamespaceInfo(),
2129 $services->getRevisionLookup(),
2130 $services->getLinkBatchFactory()
2131 );
2132 $store->setStatsdDataFactory( $services->getStatsdDataFactory() );
2133
2134 if ( $services->getMainConfig()->get( MainConfigNames::ReadOnlyWatchedItemStore ) ) {
2135 $store = new NoWriteWatchedItemStore( $store );
2136 }
2137
2138 return $store;
2139 },
2140
2141 'WatchlistManager' => static function ( MediaWikiServices $services ): WatchlistManager {
2143 new ServiceOptions(
2144 WatchlistManager::CONSTRUCTOR_OPTIONS,
2145 $services->getMainConfig()
2146 ),
2147 $services->getHookContainer(),
2148 $services->getReadOnlyMode(),
2149 $services->getRevisionLookup(),
2150 $services->getTalkPageNotificationManager(),
2151 $services->getWatchedItemStore(),
2152 $services->getUserFactory(),
2153 $services->getNamespaceInfo(),
2154 $services->getWikiPageFactory()
2155 );
2156 },
2157
2158 'WikiExporterFactory' => static function ( MediaWikiServices $services ): WikiExporterFactory {
2160 $services->getHookContainer(),
2161 $services->getRevisionStore(),
2162 $services->getTitleParser()
2163 );
2164 },
2165
2166 'WikiImporterFactory' => static function ( MediaWikiServices $services ): WikiImporterFactory {
2168 $services->getMainConfig(),
2169 $services->getHookContainer(),
2170 $services->getContentLanguage(),
2171 $services->getNamespaceInfo(),
2172 $services->getTitleFactory(),
2173 $services->getWikiPageFactory(),
2174 $services->getWikiRevisionUploadImporter(),
2175 $services->getPermissionManager(),
2176 $services->getContentHandlerFactory(),
2177 $services->getSlotRoleRegistry()
2178 );
2179 },
2180
2181 'WikiPageFactory' => static function ( MediaWikiServices $services ): WikiPageFactory {
2183 $services->getTitleFactory(),
2184 new HookRunner( $services->getHookContainer() ),
2185 $services->getDBLoadBalancer()
2186 );
2187 },
2188
2189 'WikiRevisionOldRevisionImporterNoUpdates' =>
2190 static function ( MediaWikiServices $services ): ImportableOldRevisionImporter {
2192 false,
2193 LoggerFactory::getInstance( 'OldRevisionImporter' ),
2194 $services->getDBLoadBalancer(),
2195 $services->getRevisionStore(),
2196 $services->getSlotRoleRegistry(),
2197 $services->getWikiPageFactory(),
2198 $services->getPageUpdaterFactory(),
2199 $services->getUserFactory()
2200 );
2201 },
2202
2203 'WRStatsFactory' => static function ( MediaWikiServices $services ): WRStatsFactory {
2206 ObjectCache::getInstance( $services->getMainConfig()->get( MainConfigNames::StatsCacheType ) )
2207 )
2208 );
2209 },
2210
2211 '_DefaultOptionsLookup' => static function ( MediaWikiServices $services ): DefaultOptionsLookup {
2213 new ServiceOptions( DefaultOptionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
2214 $services->getContentLanguage(),
2215 $services->getHookContainer(),
2216 $services->getNamespaceInfo()
2217 );
2218 },
2219
2220 '_EditConstraintFactory' => static function ( MediaWikiServices $services ): EditConstraintFactory {
2221 // This service is internal and currently only exists because a significant number
2222 // of dependencies will be needed by different constraints. It is not part of
2223 // the public interface and has no corresponding method in MediaWikiServices
2225 // Multiple
2226 new ServiceOptions(
2227 EditConstraintFactory::CONSTRUCTOR_OPTIONS,
2228 $services->getMainConfig()
2229 ),
2230 LoggerFactory::getProvider(),
2231
2232 // UserBlockConstraint
2233 $services->getPermissionManager(),
2234
2235 // EditFilterMergedContentHookConstraint
2236 $services->getHookContainer(),
2237
2238 // ReadOnlyConstraint
2239 $services->getReadOnlyMode(),
2240
2241 // SpamRegexConstraint
2242 $services->getSpamChecker()
2243 );
2244 },
2245
2246 '_MediaWikiTitleCodec' => static function ( MediaWikiServices $services ): MediaWikiTitleCodec {
2248 $services->getContentLanguage(),
2249 $services->getGenderCache(),
2250 $services->getMainConfig()->get( MainConfigNames::LocalInterwikis ),
2251 $services->getInterwikiLookup(),
2252 $services->getNamespaceInfo()
2253 );
2254 },
2255
2256 '_PageCommandFactory' => static function ( MediaWikiServices $services ): PageCommandFactory {
2258 $services->getMainConfig(),
2259 $services->getDBLoadBalancerFactory(),
2260 $services->getNamespaceInfo(),
2261 $services->getWatchedItemStore(),
2262 $services->getRepoGroup(),
2263 $services->getReadOnlyMode(),
2264 $services->getContentHandlerFactory(),
2265 $services->getRevisionStore(),
2266 $services->getSpamChecker(),
2267 $services->getTitleFormatter(),
2268 $services->getHookContainer(),
2269 $services->getWikiPageFactory(),
2270 $services->getUserFactory(),
2271 $services->getActorMigration(),
2272 $services->getActorNormalization(),
2273 $services->getTitleFactory(),
2274 $services->getUserEditTracker(),
2275 $services->getCollationFactory(),
2276 $services->getJobQueueGroup(),
2277 $services->getCommentStore(),
2278 $services->getMainObjectStash(),
2279 WikiMap::getCurrentWikiDbDomain()->getId(),
2280 WebRequest::getRequestId(),
2281 $services->getBacklinkCacheFactory(),
2282 LoggerFactory::getInstance( 'UndeletePage' ),
2283 $services->getPageUpdaterFactory(),
2284 $services->getMessageFormatterFactory()->getTextFormatter(
2285 $services->getContentLanguage()->getCode()
2286 ),
2287 $services->getArchivedRevisionLookup(),
2288 $services->getRestrictionStore()
2289 );
2290 },
2291
2292 '_ParserObserver' => static function ( MediaWikiServices $services ): ParserObserver {
2293 return new ParserObserver( LoggerFactory::getInstance( 'DuplicateParse' ) );
2294 },
2295
2296 '_Parsoid' => static function ( MediaWikiServices $services ): Parsoid {
2297 return new Parsoid(
2298 $services->getParsoidSiteConfig(),
2299 $services->getParsoidDataAccess()
2300 );
2301 },
2302
2303 '_SqlBlobStore' => static function ( MediaWikiServices $services ): SqlBlobStore {
2304 return $services->getBlobStoreFactory()->newSqlBlobStore();
2305 },
2306
2307 '_UserBlockCommandFactory' => static function ( MediaWikiServices $services ): UserBlockCommandFactory {
2309 new ServiceOptions( UserBlockCommandFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
2310 $services->getHookContainer(),
2311 $services->getBlockPermissionCheckerFactory(),
2312 $services->getBlockUtils(),
2313 $services->getDatabaseBlockStore(),
2314 $services->getBlockRestrictionStore(),
2315 $services->getUserFactory(),
2316 $services->getUserEditTracker(),
2317 LoggerFactory::getInstance( 'BlockManager' ),
2318 $services->getTitleFactory(),
2319 $services->getBlockActionInfo()
2320 );
2321 },
2322
2324 // NOTE: When adding a service here, don't forget to add a getter function
2325 // in the MediaWikiServices class. The convenience getter should just call
2326 // $this->getService( 'FooBarService' ).
2328
2329];
const MIGRATION_NEW
Definition Defines.php:306
const SCHEMA_COMPAT_NEW
Definition Defines.php:279
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfShellExec( $cmd, &$retval=null, $environ=[], $limits=[], $options=[])
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
return[ 'ActionFactory'=> static function(MediaWikiServices $services):ActionFactory { return new ActionFactory($services->getMainConfig() ->get(MainConfigNames::Actions), LoggerFactory::getInstance( 'ActionFactory'), $services->getObjectFactory(), $services->getHookContainer());}, 'ActorMigration'=> static function(MediaWikiServices $services):ActorMigration { return new ActorMigration(SCHEMA_COMPAT_NEW, $services->getActorStoreFactory());}, 'ActorNormalization'=> static function(MediaWikiServices $services):ActorNormalization { return $services->getActorStoreFactory() ->getActorNormalization();}, 'ActorStore'=> static function(MediaWikiServices $services):ActorStore { return $services->getActorStoreFactory() ->getActorStore();}, 'ActorStoreFactory'=> static function(MediaWikiServices $services):ActorStoreFactory { return new ActorStoreFactory(new ServiceOptions(ActorStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancerFactory(), $services->getUserNameUtils(), LoggerFactory::getInstance( 'ActorStore'));}, 'ArchivedRevisionLookup'=> static function(MediaWikiServices $services):ArchivedRevisionLookup { return new ArchivedRevisionLookup($services->getDBLoadBalancer(), $services->getRevisionStore());}, 'AuthManager'=> static function(MediaWikiServices $services):AuthManager { $authManager=new AuthManager(RequestContext::getMain() ->getRequest(), $services->getMainConfig(), $services->getObjectFactory(), $services->getHookContainer(), $services->getReadOnlyMode(), $services->getUserNameUtils(), $services->getBlockManager(), $services->getWatchlistManager(), $services->getDBLoadBalancer(), $services->getContentLanguage(), $services->getLanguageConverterFactory(), $services->getBotPasswordStore(), $services->getUserFactory(), $services->getUserIdentityLookup(), $services->getUserOptionsManager());$authManager->setLogger(LoggerFactory::getInstance( 'authentication'));return $authManager;}, 'BacklinkCacheFactory'=> static function(MediaWikiServices $services):BacklinkCacheFactory { return new BacklinkCacheFactory( $services->getMainWANObjectCache());}, 'BadFileLookup'=> static function(MediaWikiServices $services):BadFileLookup { return new BadFileLookup(static function() { return wfMessage( 'bad_image_list') ->inContentLanguage() ->plain();}, $services->getLocalServerObjectCache(), $services->getRepoGroup(), $services->getTitleParser(), $services->getHookContainer());}, 'BlobStore'=> static function(MediaWikiServices $services):BlobStore { return $services->getService( '_SqlBlobStore');}, 'BlobStoreFactory'=> static function(MediaWikiServices $services):BlobStoreFactory { return new BlobStoreFactory($services->getDBLoadBalancerFactory(), $services->getExternalStoreAccess(), $services->getMainWANObjectCache(), new ServiceOptions(BlobStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'BlockActionInfo'=> static function(MediaWikiServices $services):BlockActionInfo { return new BlockActionInfo( $services->getHookContainer());}, 'BlockErrorFormatter'=> static function(MediaWikiServices $services):BlockErrorFormatter { return new BlockErrorFormatter($services->getTitleFormatter());}, 'BlockManager'=> static function(MediaWikiServices $services):BlockManager { return new BlockManager(new ServiceOptions(BlockManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getPermissionManager(), $services->getUserFactory(), LoggerFactory::getInstance( 'BlockManager'), $services->getHookContainer());}, 'BlockPermissionCheckerFactory'=> static function(MediaWikiServices $services):BlockPermissionCheckerFactory { return new BlockPermissionCheckerFactory(new ServiceOptions(BlockPermissionCheckerFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getBlockUtils());}, 'BlockRestrictionStore'=> static function(MediaWikiServices $services):BlockRestrictionStore { return $services->getBlockRestrictionStoreFactory() ->getBlockRestrictionStore(WikiAwareEntity::LOCAL);}, 'BlockRestrictionStoreFactory'=> static function(MediaWikiServices $services):BlockRestrictionStoreFactory { return new BlockRestrictionStoreFactory($services->getDBLoadBalancerFactory());}, 'BlockUserFactory'=> static function(MediaWikiServices $services):BlockUserFactory { return $services->getService( '_UserBlockCommandFactory');}, 'BlockUtils'=> static function(MediaWikiServices $services):BlockUtils { return new BlockUtils(new ServiceOptions(BlockUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getUserIdentityLookup(), $services->getUserNameUtils());}, 'BotPasswordStore'=> static function(MediaWikiServices $services):BotPasswordStore { return new BotPasswordStore(new ServiceOptions(BotPasswordStore::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getCentralIdLookup(), $services->getDBLoadBalancerFactory());}, 'CentralIdLookup'=> static function(MediaWikiServices $services):CentralIdLookup { return $services->getCentralIdLookupFactory() ->getLookup();}, 'CentralIdLookupFactory'=> static function(MediaWikiServices $services):CentralIdLookupFactory { return new CentralIdLookupFactory(new ServiceOptions(CentralIdLookupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getObjectFactory(), $services->getUserIdentityLookup());}, 'ChangeTagDefStore'=> static function(MediaWikiServices $services):NameTableStore { return $services->getNameTableStoreFactory() ->getChangeTagDef();}, 'CollationFactory'=> static function(MediaWikiServices $services):CollationFactory { return new CollationFactory(new ServiceOptions(CollationFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getObjectFactory(), $services->getHookContainer());}, 'CommentFormatter'=> static function(MediaWikiServices $services):CommentFormatter { $linkRenderer=$services->getLinkRendererFactory() ->create([ 'renderForComment'=> true]);$parserFactory=new CommentParserFactory($linkRenderer, $services->getLinkBatchFactory(), $services->getLinkCache(), $services->getRepoGroup(), RequestContext::getMain() ->getLanguage(), $services->getContentLanguage(), $services->getTitleParser(), $services->getNamespaceInfo(), $services->getHookContainer());return new CommentFormatter( $parserFactory);}, 'CommentStore'=> static function(MediaWikiServices $services):CommentStore { return new CommentStore($services->getContentLanguage(), MIGRATION_NEW);}, 'ConfigFactory'=> static function(MediaWikiServices $services):ConfigFactory { $registry=$services->getBootstrapConfig() ->get(MainConfigNames::ConfigRegistry);$factory=new ConfigFactory();foreach( $registry as $name=> $callback) { $factory->register( $name, $callback);} return $factory;}, 'ConfigRepository'=> static function(MediaWikiServices $services):ConfigRepository { return new ConfigRepository( $services->getConfigFactory());}, 'ConfigSchema'=> static function(MediaWikiServices $services):ConfigSchema { global $wgSettings;return $wgSettings->getConfigSchema();}, 'ConfiguredReadOnlyMode'=> static function(MediaWikiServices $services):ConfiguredReadOnlyMode { $config=$services->getMainConfig();return new ConfiguredReadOnlyMode($config->get(MainConfigNames::ReadOnly), $config->get(MainConfigNames::ReadOnlyFile));}, 'ContentHandlerFactory'=> static function(MediaWikiServices $services):IContentHandlerFactory { $contentHandlerConfig=$services->getMainConfig() ->get(MainConfigNames::ContentHandlers);return new ContentHandlerFactory($contentHandlerConfig, $services->getObjectFactory(), $services->getHookContainer(), LoggerFactory::getInstance( 'ContentHandler'));}, 'ContentLanguage'=> static function(MediaWikiServices $services):Language { return $services->getLanguageFactory() ->getLanguage($services->getMainConfig() ->get(MainConfigNames::LanguageCode));}, 'ContentModelChangeFactory'=> static function(MediaWikiServices $services):ContentModelChangeFactory { return $services->getService( '_PageCommandFactory');}, 'ContentModelStore'=> static function(MediaWikiServices $services):NameTableStore { return $services->getNameTableStoreFactory() ->getContentModels();}, 'ContentRenderer'=> static function(MediaWikiServices $services):ContentRenderer { return new ContentRenderer( $services->getContentHandlerFactory());}, 'ContentTransformer'=> static function(MediaWikiServices $services):ContentTransformer { return new ContentTransformer( $services->getContentHandlerFactory());}, 'ContributionsLookup'=> static function(MediaWikiServices $services):ContributionsLookup { return new ContributionsLookup($services->getRevisionStore(), $services->getLinkRendererFactory(), $services->getLinkBatchFactory(), $services->getHookContainer(), $services->getDBLoadBalancer(), $services->getActorMigration(), $services->getNamespaceInfo(), $services->getCommentFormatter());}, 'CriticalSectionProvider'=> static function(MediaWikiServices $services):CriticalSectionProvider { $config=$services->getMainConfig();$limit=$GLOBALS[ 'wgCommandLineMode'] ? INF :$config->get(MainConfigNames::CriticalSectionTimeLimit);return RequestTimeout::singleton() ->createCriticalSectionProvider( $limit);}, 'CryptHKDF'=> static function(MediaWikiServices $services):CryptHKDF { $config=$services->getMainConfig();$secret=$config->get(MainConfigNames::HKDFSecret) ?:$config->get(MainConfigNames::SecretKey);if(! $secret) { throw new RuntimeException("Cannot use MWCryptHKDF without a secret.");} $context=[microtime(), getmypid(), gethostname()];$cache=$services->getLocalServerObjectCache();if( $cache instanceof EmptyBagOStuff) { $cache=ObjectCache::getLocalClusterInstance();} return new CryptHKDF( $secret, $config->get(MainConfigNames::HKDFAlgorithm), $cache, $context);}, 'DatabaseBlockStore'=> static function(MediaWikiServices $services):DatabaseBlockStore { return new DatabaseBlockStore(new ServiceOptions(DatabaseBlockStore::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), LoggerFactory::getInstance( 'DatabaseBlockStore'), $services->getActorStoreFactory(), $services->getBlockRestrictionStore(), $services->getCommentStore(), $services->getHookContainer(), $services->getDBLoadBalancer(), $services->getReadOnlyMode(), $services->getUserFactory());}, 'DatabaseFactory'=> static function(MediaWikiServices $services):DatabaseFactory { return new DatabaseFactory();}, 'DateFormatterFactory'=> static function(MediaWikiServices $services):DateFormatterFactory { return new DateFormatterFactory();}, 'DBLoadBalancer'=> static function(MediaWikiServices $services):Wikimedia\Rdbms\ILoadBalancer { return $services->getDBLoadBalancerFactory() ->getMainLB();}, 'DBLoadBalancerFactory'=> static function(MediaWikiServices $services):Wikimedia\Rdbms\LBFactory { $mainConfig=$services->getMainConfig();$lbFactoryConfigBuilder=$services->getDBLoadBalancerFactoryConfigBuilder();$lbConf=$lbFactoryConfigBuilder->applyDefaultConfig($mainConfig->get(MainConfigNames::LBFactoryConf));$class=$lbFactoryConfigBuilder->getLBFactoryClass( $lbConf);$instance=new $class( $lbConf);$lbFactoryConfigBuilder->setDomainAliases( $instance);$lbFactoryConfigBuilder->applyGlobalState($instance, $mainConfig, $services->getStatsdDataFactory());return $instance;}, 'DBLoadBalancerFactoryConfigBuilder'=> static function(MediaWikiServices $services):MWLBFactory { $cpStashType=$services->getMainConfig() ->get(MainConfigNames::ChronologyProtectorStash);if(is_string( $cpStashType)) { $cpStash=ObjectCache::getInstance( $cpStashType);} else { try { $cpStash=ObjectCache::getLocalClusterInstance();} catch(RecursiveServiceDependencyException $e) { $cpStash=new EmptyBagOStuff();} } try { $wanCache=$services->getMainWANObjectCache();} catch(RecursiveServiceDependencyException $e) { $wanCache=WANObjectCache::newEmpty();} $srvCache=$services->getLocalServerObjectCache();if( $srvCache instanceof EmptyBagOStuff) { $srvCache=new HashBagOStuff([ 'maxKeys'=> 100]);} return new MWLBFactory(new ServiceOptions(MWLBFactory::APPLY_DEFAULT_CONFIG_OPTIONS, $services->getMainConfig()), $services->getConfiguredReadOnlyMode(), $cpStash, $srvCache, $wanCache, $services->getCriticalSectionProvider(), $services->getStatsdDataFactory(), $services->getDatabaseFactory());}, 'DeletePageFactory'=> static function(MediaWikiServices $services):DeletePageFactory { return $services->getService( '_PageCommandFactory');}, 'Emailer'=> static function(MediaWikiServices $services):IEmailer { return new Emailer();}, 'EventRelayerGroup'=> static function(MediaWikiServices $services):EventRelayerGroup { return new EventRelayerGroup( $services->getMainConfig() ->get(MainConfigNames::EventRelayerConfig));}, 'ExternalStoreAccess'=> static function(MediaWikiServices $services):ExternalStoreAccess { return new ExternalStoreAccess($services->getExternalStoreFactory(), LoggerFactory::getInstance( 'ExternalStore'));}, 'ExternalStoreFactory'=> static function(MediaWikiServices $services):ExternalStoreFactory { $config=$services->getMainConfig();$writeStores=$config->get(MainConfigNames::DefaultExternalStore);return new ExternalStoreFactory($config->get(MainConfigNames::ExternalStores),( $writeStores !==false) ?(array) $writeStores :[], $services->getDBLoadBalancer() ->getLocalDomainID(), LoggerFactory::getInstance( 'ExternalStore'));}, 'FileBackendGroup'=> static function(MediaWikiServices $services):FileBackendGroup { $mainConfig=$services->getMainConfig();$ld=WikiMap::getCurrentWikiDbDomain();$fallbackWikiId=WikiMap::getWikiIdFromDbDomain( $ld);$legacyDomainId=strlen( $ld->getTablePrefix()) ? "{$ld->getDatabase()}-{$ld->getTablePrefix()}" :$ld->getDatabase();if( $ld->getSchema() !==null && $legacyDomainId !==$fallbackWikiId) { wfWarn("Legacy default 'domainId' is '$legacyDomainId' but wiki ID is '$fallbackWikiId'.");} $cache=$services->getLocalServerObjectCache();if( $cache instanceof EmptyBagOStuff) { $cache=new HashBagOStuff();} return new FileBackendGroup(new ServiceOptions(FileBackendGroup::CONSTRUCTOR_OPTIONS, $mainConfig, [ 'fallbackWikiId'=> $fallbackWikiId]), $services->getConfiguredReadOnlyMode(), $cache, $services->getMainWANObjectCache(), $services->getMimeAnalyzer(), $services->getLockManagerGroupFactory(), $services->getTempFSFileFactory(), $services->getObjectFactory());}, 'GenderCache'=> static function(MediaWikiServices $services):GenderCache { $nsInfo=$services->getNamespaceInfo();$dbLoadBalancer=$services->isServiceDisabled( 'DBLoadBalancer') ? null :$services->getDBLoadBalancer();return new GenderCache( $nsInfo, $dbLoadBalancer, $services->get( '_DefaultOptionsLookup'));}, 'GlobalIdGenerator'=> static function(MediaWikiServices $services):GlobalIdGenerator { $mainConfig=$services->getMainConfig();return new GlobalIdGenerator($mainConfig->get(MainConfigNames::TmpDirectory), static function( $command) { return wfShellExec( $command);});}, 'GrantsInfo'=> static function(MediaWikiServices $services):GrantsInfo { return new GrantsInfo(new ServiceOptions(GrantsInfo::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'GrantsLocalization'=> static function(MediaWikiServices $services):GrantsLocalization { return new GrantsLocalization($services->getGrantsInfo(), $services->getLinkRenderer(), $services->getLanguageFactory(), $services->getContentLanguage());}, 'GroupPermissionsLookup'=> static function(MediaWikiServices $services):GroupPermissionsLookup { return new GroupPermissionsLookup(new ServiceOptions(GroupPermissionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'HookContainer'=> static function(MediaWikiServices $services):HookContainer { $extRegistry=ExtensionRegistry::getInstance();$extDeprecatedHooks=$extRegistry->getAttribute( 'DeprecatedHooks');$deprecatedHooks=new DeprecatedHooks( $extDeprecatedHooks);$hookRegistry=new GlobalHookRegistry( $extRegistry, $deprecatedHooks);return new HookContainer($hookRegistry, $services->getObjectFactory());}, 'HtmlCacheUpdater'=> static function(MediaWikiServices $services):HtmlCacheUpdater { $config=$services->getMainConfig();return new HtmlCacheUpdater($services->getHookContainer(), $services->getTitleFactory(), $config->get(MainConfigNames::CdnReboundPurgeDelay), $config->get(MainConfigNames::UseFileCache), $config->get(MainConfigNames::CdnMaxAge));}, 'HTMLTransformFactory'=> static function(MediaWikiServices $services):HTMLTransformFactory { return new HTMLTransformFactory($services->getService( '_Parsoid'), $services->getMainConfig() ->get(MainConfigNames::ParsoidSettings), $services->getParsoidPageConfigFactory());}, 'HttpRequestFactory'=> static function(MediaWikiServices $services):HttpRequestFactory { return new HttpRequestFactory(new ServiceOptions(HttpRequestFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), LoggerFactory::getInstance( 'http'));}, 'InterwikiLookup'=> static function(MediaWikiServices $services):InterwikiLookup { $config=$services->getMainConfig();return new ClassicInterwikiLookup($services->getContentLanguage(), $services->getMainWANObjectCache(), $services->getHookContainer(), $services->getDBLoadBalancer(), $config->get(MainConfigNames::InterwikiExpiry), $config->get(MainConfigNames::InterwikiCache), $config->get(MainConfigNames::InterwikiScopes), $config->get(MainConfigNames::InterwikiFallbackSite));}, 'JobQueueGroup'=> static function(MediaWikiServices $services):JobQueueGroup { return $services->getJobQueueGroupFactory() ->makeJobQueueGroup();}, 'JobQueueGroupFactory'=> static function(MediaWikiServices $services):JobQueueGroupFactory { return new JobQueueGroupFactory(new ServiceOptions(JobQueueGroupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getConfiguredReadOnlyMode(), $services->getStatsdDataFactory(), $services->getMainWANObjectCache(), $services->getGlobalIdGenerator());}, 'JobRunner'=> static function(MediaWikiServices $services):JobRunner { return new JobRunner(new ServiceOptions(JobRunner::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancerFactory(), $services->getJobQueueGroup(), $services->getReadOnlyMode(), $services->getLinkCache(), $services->getStatsdDataFactory(), LoggerFactory::getInstance( 'runJobs'));}, 'JsonCodec'=> static function(MediaWikiServices $services):JsonCodec { return new JsonCodec();}, 'LanguageConverterFactory'=> static function(MediaWikiServices $services):LanguageConverterFactory { $usePigLatinVariant=$services->getMainConfig() ->get(MainConfigNames::UsePigLatinVariant);$isConversionDisabled=$services->getMainConfig() ->get(MainConfigNames::DisableLangConversion);$isTitleConversionDisabled=$services->getMainConfig() ->get(MainConfigNames::DisableTitleConversion);return new LanguageConverterFactory($services->getObjectFactory(), $usePigLatinVariant, $isConversionDisabled, $isTitleConversionDisabled, static function() use( $services) { return $services->getContentLanguage();});}, 'LanguageFactory'=> static function(MediaWikiServices $services):LanguageFactory { return new LanguageFactory(new ServiceOptions(LanguageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getNamespaceInfo(), $services->getLocalisationCache(), $services->getLanguageNameUtils(), $services->getLanguageFallback(), $services->getLanguageConverterFactory(), $services->getHookContainer(), $services->getMainConfig());}, 'LanguageFallback'=> static function(MediaWikiServices $services):LanguageFallback { return new LanguageFallback($services->getMainConfig() ->get(MainConfigNames::LanguageCode), $services->getLocalisationCache(), $services->getLanguageNameUtils());}, 'LanguageNameUtils'=> static function(MediaWikiServices $services):LanguageNameUtils { return new LanguageNameUtils(new ServiceOptions(LanguageNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getHookContainer());}, 'LinkBatchFactory'=> static function(MediaWikiServices $services):LinkBatchFactory { return new LinkBatchFactory($services->getLinkCache(), $services->getTitleFormatter(), $services->getContentLanguage(), $services->getGenderCache(), $services->getDBLoadBalancer(), $services->getLinksMigration(), LoggerFactory::getInstance( 'LinkBatch'));}, 'LinkCache'=> static function(MediaWikiServices $services):LinkCache { $dbLoadBalancer=$services->isServiceDisabled( 'DBLoadBalancer') ? null :$services->getDBLoadBalancer();$linkCache=new LinkCache($services->getTitleFormatter(), $services->getMainWANObjectCache(), $services->getNamespaceInfo(), $dbLoadBalancer);$linkCache->setLogger(LoggerFactory::getInstance( 'LinkCache'));return $linkCache;}, 'LinkRenderer'=> static function(MediaWikiServices $services):LinkRenderer { return $services->getLinkRendererFactory() ->create();}, 'LinkRendererFactory'=> static function(MediaWikiServices $services):LinkRendererFactory { return new LinkRendererFactory($services->getTitleFormatter(), $services->getLinkCache(), $services->getSpecialPageFactory(), $services->getHookContainer());}, 'LinksMigration'=> static function(MediaWikiServices $services):LinksMigration { return new LinksMigration($services->getMainConfig(), $services->getLinkTargetLookup());}, 'LinkTargetLookup'=> static function(MediaWikiServices $services):LinkTargetLookup { return new LinkTargetStore($services->getDBLoadBalancer(), $services->getLocalServerObjectCache(), $services->getMainWANObjectCache());}, 'LocalisationCache'=> static function(MediaWikiServices $services):LocalisationCache { $conf=$services->getMainConfig() ->get(MainConfigNames::LocalisationCacheConf);$logger=LoggerFactory::getInstance( 'localisation');$store=LocalisationCache::getStoreFromConf($conf, $services->getMainConfig() ->get(MainConfigNames::CacheDirectory));$logger->debug( 'LocalisationCache using store ' . get_class( $store));return new $conf['class'](new ServiceOptions(LocalisationCache::CONSTRUCTOR_OPTIONS, $conf, ['forceRecache'=> false, 'manualRecache'=> false,], $services->getMainConfig()), $store, $logger, [static function() use( $services) { MessageBlobStore::clearGlobalCacheEntry( $services->getMainWANObjectCache());}], $services->getLanguageNameUtils(), $services->getHookContainer());}, 'LocalServerObjectCache'=> static function(MediaWikiServices $services):BagOStuff { return ObjectCache::makeLocalServerCache();}, 'LockManagerGroupFactory'=> static function(MediaWikiServices $services):LockManagerGroupFactory { return new LockManagerGroupFactory(WikiMap::getCurrentWikiDbDomain() ->getId(), $services->getMainConfig() ->get(MainConfigNames::LockManagers));}, 'MagicWordFactory'=> static function(MediaWikiServices $services):MagicWordFactory { return new MagicWordFactory($services->getContentLanguage(), $services->getHookContainer());}, 'MainConfig'=> static function(MediaWikiServices $services):Config { return $services->getConfigFactory() ->makeConfig( 'main');}, 'MainObjectStash'=> static function(MediaWikiServices $services):BagOStuff { $mainConfig=$services->getMainConfig();$id=$mainConfig->get(MainConfigNames::MainStash);$params=$mainConfig->get(MainConfigNames::ObjectCaches)[$id] ?? null;if(! $params) { throw new UnexpectedValueException("\$wgObjectCaches must have \"$id\" set (via \$wgMainStash)");} $params['stats']=$services->getStatsdDataFactory();$store=ObjectCache::newFromParams( $params, $mainConfig);$store->getLogger() ->debug( 'MainObjectStash using store {class}', ['class'=> get_class( $store)]);return $store;}, 'MainWANObjectCache'=> static function(MediaWikiServices $services):WANObjectCache { $mainConfig=$services->getMainConfig();$wanId=$mainConfig->get(MainConfigNames::MainWANCache);$wanParams=$mainConfig->get(MainConfigNames::WANObjectCaches)[$wanId] ?? null;if(! $wanParams) { throw new UnexpectedValueException("wgWANObjectCaches must have \"$wanId\" set (via wgMainWANCache)");} $cacheId=$wanParams['cacheId'];$wanClass=$wanParams['class'];unset( $wanParams['cacheId']);unset( $wanParams['class']);$storeParams=$mainConfig->get(MainConfigNames::ObjectCaches)[$cacheId] ?? null;if(! $storeParams) { throw new UnexpectedValueException("wgObjectCaches must have \"$cacheId\" set (via wgWANObjectCaches)");} $storeParams['stats']=$services->getStatsdDataFactory();$store=ObjectCache::newFromParams( $storeParams, $mainConfig);$logger=$store->getLogger();$logger->debug( 'MainWANObjectCache using store {class}', ['class'=> get_class( $store)]);$wanParams['cache']=$store;$wanParams['logger']=$logger;$wanParams['secret']=$wanParams['secret'] ?? $mainConfig->get(MainConfigNames::SecretKey);if(! $GLOBALS[ 'wgCommandLineMode']) { $wanParams['stats']=$services->getStatsdDataFactory();$wanParams['asyncHandler']=[DeferredUpdates::class, 'addCallableUpdate'];} $instance=new $wanClass( $wanParams);' @phan-var WANObjectCache $instance';return $instance;}, 'MediaHandlerFactory'=> static function(MediaWikiServices $services):MediaHandlerFactory { return new MediaHandlerFactory(LoggerFactory::getInstance( 'MediaHandlerFactory'), $services->getMainConfig() ->get(MainConfigNames::MediaHandlers));}, 'MergeHistoryFactory'=> static function(MediaWikiServices $services):MergeHistoryFactory { return $services->getService( '_PageCommandFactory');}, 'MessageCache'=> static function(MediaWikiServices $services):MessageCache { $mainConfig=$services->getMainConfig();$clusterCache=ObjectCache::getInstance( $mainConfig->get(MainConfigNames::MessageCacheType));$srvCache=$mainConfig->get(MainConfigNames::UseLocalMessageCache) ? $services->getLocalServerObjectCache() :new EmptyBagOStuff();$logger=LoggerFactory::getInstance( 'MessageCache');$logger->debug( 'MessageCache using store {class}', ['class'=> get_class( $clusterCache)]);$options=new ServiceOptions(MessageCache::CONSTRUCTOR_OPTIONS, $mainConfig);return new MessageCache($services->getMainWANObjectCache(), $clusterCache, $srvCache, $services->getContentLanguage(), $services->getLanguageConverterFactory(), $logger, $options, $services->getLanguageFactory(), $services->getLocalisationCache(), $services->getLanguageNameUtils(), $services->getLanguageFallback(), $services->getHookContainer());}, 'MessageFormatterFactory'=> static function(MediaWikiServices $services):IMessageFormatterFactory { return new MessageFormatterFactory();}, 'MetricsFactory'=> static function(MediaWikiServices $services):MetricsFactory { $config=$services->getMainConfig();return new MetricsFactory(['target'=> $config->get(MainConfigNames::MetricsTarget), 'format'=> $config->get(MainConfigNames::MetricsFormat), 'prefix'=> $config->get(MainConfigNames::MetricsPrefix),], LoggerFactory::getInstance( 'Metrics'));}, 'MimeAnalyzer'=> static function(MediaWikiServices $services):MimeAnalyzer { $logger=LoggerFactory::getInstance( 'Mime');$mainConfig=$services->getMainConfig();$hookRunner=new HookRunner( $services->getHookContainer());$params=['typeFile'=> $mainConfig->get(MainConfigNames::MimeTypeFile), 'infoFile'=> $mainConfig->get(MainConfigNames::MimeInfoFile), 'xmlTypes'=> $mainConfig->get(MainConfigNames::XMLMimeTypes), 'guessCallback'=> static function( $mimeAnalyzer, &$head, &$tail, $file, &$mime) use( $logger, $hookRunner) { $deja=new DjVuImage( $file);if( $deja->isValid()) { $logger->info("Detected $file as image/vnd.djvu\n");$mime='image/vnd.djvu';return;} $hookRunner->onMimeMagicGuessFromContent($mimeAnalyzer, $head, $tail, $file, $mime);}, 'extCallback'=> static function( $mimeAnalyzer, $ext, &$mime) use( $hookRunner) { $hookRunner->onMimeMagicImproveFromExtension( $mimeAnalyzer, $ext, $mime);}, 'initCallback'=> static function( $mimeAnalyzer) use( $hookRunner) { $hookRunner->onMimeMagicInit( $mimeAnalyzer);}, 'logger'=> $logger];if( $params['infoFile']==='includes/mime.info') { $params['infoFile']=MimeAnalyzer::USE_INTERNAL;} if( $params['typeFile']==='includes/mime.types') { $params['typeFile']=MimeAnalyzer::USE_INTERNAL;} $detectorCmd=$mainConfig->get(MainConfigNames::MimeDetectorCommand);if( $detectorCmd) { $factory=$services->getShellCommandFactory();$params['detectCallback']=static function( $file) use( $detectorCmd, $factory) { $result=$factory->create() ->unsafeParams( $detectorCmd) ->params( $file) ->execute();return $result->getStdout();};} return new MimeAnalyzer( $params);}, 'MovePageFactory'=> static function(MediaWikiServices $services):MovePageFactory { return $services->getService( '_PageCommandFactory');}, 'NamespaceInfo'=> static function(MediaWikiServices $services):NamespaceInfo { return new NamespaceInfo(new ServiceOptions(NamespaceInfo::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getHookContainer());}, 'NameTableStoreFactory'=> static function(MediaWikiServices $services):NameTableStoreFactory { return new NameTableStoreFactory($services->getDBLoadBalancerFactory(), $services->getMainWANObjectCache(), LoggerFactory::getInstance( 'NameTableSqlStore'));}, 'ObjectFactory'=> static function(MediaWikiServices $services):ObjectFactory { return new ObjectFactory( $services);}, 'OldRevisionImporter'=> static function(MediaWikiServices $services):OldRevisionImporter { return new ImportableOldRevisionImporter(true, LoggerFactory::getInstance( 'OldRevisionImporter'), $services->getDBLoadBalancer(), $services->getRevisionStore(), $services->getSlotRoleRegistry(), $services->getWikiPageFactory(), $services->getPageUpdaterFactory(), $services->getUserFactory());}, 'PageEditStash'=> static function(MediaWikiServices $services):PageEditStash { $config=$services->getMainConfig();return new PageEditStash(ObjectCache::getLocalClusterInstance(), $services->getDBLoadBalancer(), LoggerFactory::getInstance( 'StashEdit'), $services->getStatsdDataFactory(), $services->getUserEditTracker(), $services->getUserFactory(), $services->getWikiPageFactory(), $services->getHookContainer(), defined( 'MEDIAWIKI_JOB_RUNNER')|| $GLOBALS[ 'wgCommandLineMode'] ? PageEditStash::INITIATOR_JOB_OR_CLI :PageEditStash::INITIATOR_USER);}, 'PageProps'=> static function(MediaWikiServices $services):PageProps { return new PageProps($services->getLinkBatchFactory(), $services->getDBLoadBalancer());}, 'PageStore'=> static function(MediaWikiServices $services):PageStore { return $services->getPageStoreFactory() ->getPageStore();}, 'PageStoreFactory'=> static function(MediaWikiServices $services):PageStoreFactory { $options=new ServiceOptions(PageStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig());return new PageStoreFactory($options, $services->getDBLoadBalancerFactory(), $services->getNamespaceInfo(), $services->getTitleParser(), $services->getLinkCache(), $services->getStatsdDataFactory());}, 'PageUpdaterFactory'=> static function(MediaWikiServices $services):PageUpdaterFactory { $editResultCache=new EditResultCache($services->getMainObjectStash(), $services->getDBLoadBalancer(), new ServiceOptions(EditResultCache::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));return new PageUpdaterFactory($services->getRevisionStore(), $services->getRevisionRenderer(), $services->getSlotRoleRegistry(), $services->getParserCache(), $services->getParsoidOutputAccess(), $services->getJobQueueGroup(), $services->getMessageCache(), $services->getContentLanguage(), $services->getDBLoadBalancerFactory(), $services->getContentHandlerFactory(), $services->getHookContainer(), $editResultCache, $services->getUserNameUtils(), LoggerFactory::getInstance( 'SavePage'), new ServiceOptions(PageUpdaterFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getUserEditTracker(), $services->getUserGroupManager(), $services->getTitleFormatter(), $services->getContentTransformer(), $services->getPageEditStash(), $services->getTalkPageNotificationManager(), $services->getMainWANObjectCache(), $services->getPermissionManager(), $services->getWikiPageFactory(), ChangeTags::getSoftwareTags());}, 'Parser'=> static function(MediaWikiServices $services):Parser { return $services->getParserFactory() ->getMainInstance();}, 'ParserCache'=> static function(MediaWikiServices $services):ParserCache { return $services->getParserCacheFactory() ->getParserCache(ParserCacheFactory::DEFAULT_NAME);}, 'ParserCacheFactory'=> static function(MediaWikiServices $services):ParserCacheFactory { $config=$services->getMainConfig();$cache=ObjectCache::getInstance( $config->get(MainConfigNames::ParserCacheType));$wanCache=$services->getMainWANObjectCache();$options=new ServiceOptions(ParserCacheFactory::CONSTRUCTOR_OPTIONS, $config);return new ParserCacheFactory($cache, $wanCache, $services->getHookContainer(), $services->getJsonCodec(), $services->getStatsdDataFactory(), LoggerFactory::getInstance( 'ParserCache'), $options, $services->getTitleFactory(), $services->getWikiPageFactory());}, 'ParserFactory'=> static function(MediaWikiServices $services):ParserFactory { $options=new ServiceOptions(Parser::CONSTRUCTOR_OPTIONS, $services->getMainConfig());return new ParserFactory($options, $services->getMagicWordFactory(), $services->getContentLanguage(), $services->getUrlUtils(), $services->getSpecialPageFactory(), $services->getLinkRendererFactory(), $services->getNamespaceInfo(), LoggerFactory::getInstance( 'Parser'), $services->getBadFileLookup(), $services->getLanguageConverterFactory(), $services->getHookContainer(), $services->getTidy(), $services->getMainWANObjectCache(), $services->getUserOptionsLookup(), $services->getUserFactory(), $services->getTitleFormatter(), $services->getHttpRequestFactory(), $services->getTrackingCategories(), $services->getSignatureValidatorFactory(), $services->getUserNameUtils());}, 'ParserOutputAccess'=> static function(MediaWikiServices $services):ParserOutputAccess { return new ParserOutputAccess($services->getParserCache(), $services->getParserCacheFactory() ->getRevisionOutputCache( 'rcache'), $services->getRevisionLookup(), $services->getRevisionRenderer(), $services->getStatsdDataFactory(), $services->getDBLoadBalancerFactory(), LoggerFactory::getProvider(), $services->getWikiPageFactory(), $services->getTitleFormatter());}, 'ParsoidDataAccess'=> static function(MediaWikiServices $services):DataAccess { $mainConfig=$services->getMainConfig();$parsoidSettings=$mainConfig->get(MainConfigNames::ParsoidSettings);if(!empty( $parsoidSettings['debugApi'])) { return ApiDataAccess::fromSettings( $parsoidSettings);} return new MWDataAccess(new ServiceOptions(MWDataAccess::CONSTRUCTOR_OPTIONS, $mainConfig), $services->getRepoGroup(), $services->getBadFileLookup(), $services->getHookContainer(), $services->getContentTransformer(), $services->getReadOnlyMode(), $services->getParserFactory());}, 'ParsoidOutputAccess'=> static function(MediaWikiServices $services):ParsoidOutputAccess { return new ParsoidOutputAccess(new ServiceOptions(ParsoidOutputAccess::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getParserCacheFactory(), $services->getRevisionLookup(), $services->getGlobalIdGenerator(), $services->getStatsdDataFactory(), $services->getService( '_Parsoid'), $services->getParsoidSiteConfig(), $services->getParsoidPageConfigFactory());}, 'ParsoidOutputStash'=> static function(MediaWikiServices $services):ParsoidOutputStash { $config=$services->getMainConfig() ->get(MainConfigNames::ParsoidCacheConfig);$backend=$config['StashType'] ? ObjectCache::getInstance( $config['StashType']) :$services->getMainObjectStash();return new SimpleParsoidOutputStash( $backend, $config['StashDuration']);}, 'ParsoidPageConfigFactory'=> static function(MediaWikiServices $services):MWPageConfigFactory { return new MWPageConfigFactory( $services->getRevisionStore(), $services->getSlotRoleRegistry());}, 'ParsoidSiteConfig'=> static function(MediaWikiServices $services):SiteConfig { $mainConfig=$services->getMainConfig();$parsoidSettings=$mainConfig->get(MainConfigNames::ParsoidSettings);if(!empty( $parsoidSettings['debugApi'])) { return ApiSiteConfig::fromSettings( $parsoidSettings);} return new MWSiteConfig(new ServiceOptions(MWSiteConfig::CONSTRUCTOR_OPTIONS, $mainConfig), $parsoidSettings, $services->getObjectFactory(), $services->getContentLanguage(), $services->getStatsdDataFactory(), $services->getMagicWordFactory(), $services->getNamespaceInfo(), $services->getSpecialPageFactory(), $services->getInterwikiLookup(), $services->getUserOptionsLookup(), $services->getLanguageFactory(), $services->getLanguageConverterFactory(), $services->getLanguageNameUtils(), $services->getUrlUtils(), $services->getParser(), $mainConfig);}, 'PasswordFactory'=> static function(MediaWikiServices $services):PasswordFactory { $config=$services->getMainConfig();return new PasswordFactory($config->get(MainConfigNames::PasswordConfig), $config->get(MainConfigNames::PasswordDefault));}, 'PasswordReset'=> static function(MediaWikiServices $services):PasswordReset { $options=new ServiceOptions(PasswordReset::CONSTRUCTOR_OPTIONS, $services->getMainConfig());return new PasswordReset($options, LoggerFactory::getInstance( 'authentication'), $services->getAuthManager(), $services->getHookContainer(), $services->getDBLoadBalancer(), $services->getUserFactory(), $services->getUserNameUtils(), $services->getUserOptionsLookup());}, 'PerDbNameStatsdDataFactory'=> static function(MediaWikiServices $services):StatsdDataFactoryInterface { $config=$services->getMainConfig();$wiki=$config->get(MainConfigNames::DBname);return new PrefixingStatsdDataFactoryProxy($services->getStatsdDataFactory(), $wiki);}, 'PermissionManager'=> static function(MediaWikiServices $services):PermissionManager { return new PermissionManager(new ServiceOptions(PermissionManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getSpecialPageFactory(), $services->getNamespaceInfo(), $services->getGroupPermissionsLookup(), $services->getUserGroupManager(), $services->getBlockErrorFormatter(), $services->getHookContainer(), $services->getUserCache(), $services->getRedirectLookup(), $services->getRestrictionStore(), $services->getTitleFormatter(), $services->getTempUserConfig(), $services->getUserFactory(), $services->getActionFactory());}, 'PreferencesFactory'=> static function(MediaWikiServices $services):PreferencesFactory { $factory=new DefaultPreferencesFactory(new ServiceOptions(DefaultPreferencesFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), $services->getAuthManager(), $services->getLinkRendererFactory() ->create(), $services->getNamespaceInfo(), $services->getPermissionManager(), $services->getLanguageConverterFactory() ->getLanguageConverter(), $services->getLanguageNameUtils(), $services->getHookContainer(), $services->getUserOptionsManager(), $services->getLanguageConverterFactory(), $services->getParser(), $services->getSkinFactory(), $services->getUserGroupManager(), $services->getSignatureValidatorFactory());$factory->setLogger(LoggerFactory::getInstance( 'preferences'));return $factory;}, 'ProxyLookup'=> static function(MediaWikiServices $services):ProxyLookup { $mainConfig=$services->getMainConfig();return new ProxyLookup($mainConfig->get(MainConfigNames::CdnServers), $mainConfig->get(MainConfigNames::CdnServersNoPurge), $services->getHookContainer());}, 'RateLimiter'=> static function(MediaWikiServices $services):RateLimiter { return new RateLimiter(new ServiceOptions(RateLimiter::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getWRStatsFactory(), $services->getCentralIdLookupFactory() ->getNonLocalLookup(), $services->getUserFactory(), $services->getUserGroupManager(), $services->getHookContainer());}, 'ReadOnlyMode'=> static function(MediaWikiServices $services):ReadOnlyMode { return new ReadOnlyMode($services->getConfiguredReadOnlyMode(), $services->getDBLoadBalancer());}, 'RedirectLookup'=> static function(MediaWikiServices $services):RedirectLookup { return $services->getRedirectStore();}, 'RedirectStore'=> static function(MediaWikiServices $services):RedirectStore { return new RedirectStore( $services->getWikiPageFactory());}, 'RepoGroup'=> static function(MediaWikiServices $services):RepoGroup { $config=$services->getMainConfig();return new RepoGroup($config->get(MainConfigNames::LocalFileRepo), $config->get(MainConfigNames::ForeignFileRepos), $services->getMainWANObjectCache(), $services->getMimeAnalyzer());}, 'ResourceLoader'=> static function(MediaWikiServices $services):ResourceLoader { $config=$services->getMainConfig();$maxage=$config->get(MainConfigNames::ResourceLoaderMaxage);$rl=new ResourceLoader($config, LoggerFactory::getInstance( 'resourceloader'), $config->get(MainConfigNames::ResourceLoaderUseObjectCacheForDeps) ? new KeyValueDependencyStore( $services->getMainObjectStash()) :new SqlModuleDependencyStore( $services->getDBLoadBalancer()), ['loadScript'=> $config->get(MainConfigNames::LoadScript), 'maxageVersioned'=> $maxage['versioned'] ?? null, 'maxageUnversioned'=> $maxage['unversioned'] ?? null, 'useFileCache'=> $config->get(MainConfigNames::UseFileCache),]);$extRegistry=ExtensionRegistry::getInstance();$modules=$extRegistry->getAttribute( 'ResourceModules')+ $config->get(MainConfigNames::ResourceModules);$moduleSkinStyles=$extRegistry->getAttribute( 'ResourceModuleSkinStyles')+ $config->get(MainConfigNames::ResourceModuleSkinStyles);$rl->setModuleSkinStyles( $moduleSkinStyles);$rl->addSource( $config->get(MainConfigNames::ResourceLoaderSources));$baseDir=$config->get(MainConfigNames::BaseDirectory);$rl->register(include "$baseDir/resources/Resources.php");$rl->register( $modules);$hookRunner=new \MediaWiki\ResourceLoader\HookRunner( $services->getHookContainer());$hookRunner->onResourceLoaderRegisterModules( $rl);$msgPosterAttrib=$extRegistry->getAttribute( 'MessagePosterModule');$rl->register( 'mediawiki.messagePoster', ['localBasePath'=> $baseDir, 'debugRaw'=> false, 'scripts'=> array_merge(["resources/src/mediawiki.messagePoster/factory.js", "resources/src/mediawiki.messagePoster/MessagePoster.js", "resources/src/mediawiki.messagePoster/WikitextMessagePoster.js",], $msgPosterAttrib['scripts'] ??[]), 'dependencies'=> array_merge(['oojs', 'mediawiki.api', 'mediawiki.ForeignApi',], $msgPosterAttrib['dependencies'] ??[]), 'targets'=>[ 'desktop', 'mobile'],]);if( $config->get(MainConfigNames::EnableJavaScriptTest)===true) { $rl->registerTestModules();} return $rl;}, 'RestrictionStore'=> static function(MediaWikiServices $services):RestrictionStore { return new RestrictionStore(new ServiceOptions(RestrictionStore::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getMainWANObjectCache(), $services->getDBLoadBalancer(), $services->getLinkCache(), $services->getLinksMigration(), $services->getCommentStore(), $services->getHookContainer(), $services->getPageStore());}, 'RevertedTagUpdateManager'=> static function(MediaWikiServices $services):RevertedTagUpdateManager { $editResultCache=new EditResultCache($services->getMainObjectStash(), $services->getDBLoadBalancer(), new ServiceOptions(EditResultCache::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));return new RevertedTagUpdateManager($editResultCache, $services->getJobQueueGroup());}, 'RevisionFactory'=> static function(MediaWikiServices $services):RevisionFactory { return $services->getRevisionStore();}, 'RevisionLookup'=> static function(MediaWikiServices $services):RevisionLookup { return $services->getRevisionStore();}, 'RevisionRenderer'=> static function(MediaWikiServices $services):RevisionRenderer { $renderer=new RevisionRenderer($services->getDBLoadBalancer(), $services->getSlotRoleRegistry(), $services->getContentRenderer());$renderer->setLogger(LoggerFactory::getInstance( 'SaveParse'));return $renderer;}, 'RevisionStore'=> static function(MediaWikiServices $services):RevisionStore { return $services->getRevisionStoreFactory() ->getRevisionStore();}, 'RevisionStoreFactory'=> static function(MediaWikiServices $services):RevisionStoreFactory { return new RevisionStoreFactory($services->getDBLoadBalancerFactory(), $services->getBlobStoreFactory(), $services->getNameTableStoreFactory(), $services->getSlotRoleRegistry(), $services->getMainWANObjectCache(), $services->getLocalServerObjectCache(), $services->getCommentStore(), $services->getActorMigration(), $services->getActorStoreFactory(), LoggerFactory::getInstance( 'RevisionStore'), $services->getContentHandlerFactory(), $services->getPageStoreFactory(), $services->getTitleFactory(), $services->getHookContainer());}, 'RollbackPageFactory'=> static function(MediaWikiServices $services):RollbackPageFactory { return $services->get( '_PageCommandFactory');}, 'RowCommentFormatter'=> static function(MediaWikiServices $services):RowCommentFormatter { $parserFactory=new CommentParserFactory($services->getLinkRenderer(), $services->getLinkBatchFactory(), $services->getLinkCache(), $services->getRepoGroup(), RequestContext::getMain() ->getLanguage(), $services->getContentLanguage(), $services->getTitleParser(), $services->getNamespaceInfo(), $services->getHookContainer());return new RowCommentFormatter($parserFactory, $services->getCommentStore());}, 'SearchEngineConfig'=> static function(MediaWikiServices $services):SearchEngineConfig { return new SearchEngineConfig($services->getMainConfig(), $services->getContentLanguage(), $services->getHookContainer(), ExtensionRegistry::getInstance() ->getAttribute( 'SearchMappings'), $services->getUserOptionsLookup());}, 'SearchEngineFactory'=> static function(MediaWikiServices $services):SearchEngineFactory { return new SearchEngineFactory($services->getSearchEngineConfig(), $services->getHookContainer(), $services->getDBLoadBalancer());}, 'ShellboxClientFactory'=> static function(MediaWikiServices $services):ShellboxClientFactory { $urls=$services->getMainConfig() ->get(MainConfigNames::ShellboxUrls);$url=$services->getMainConfig() ->get(MainConfigNames::ShellboxUrl);if( $url !==null) { $urls['default']=$url;} return new ShellboxClientFactory($services->getHttpRequestFactory(), $urls, $services->getMainConfig() ->get(MainConfigNames::ShellboxSecretKey));}, 'ShellCommandFactory'=> static function(MediaWikiServices $services):CommandFactory { $config=$services->getMainConfig();$limits=['time'=> $config->get(MainConfigNames::MaxShellTime), 'walltime'=> $config->get(MainConfigNames::MaxShellWallClockTime), 'memory'=> $config->get(MainConfigNames::MaxShellMemory), 'filesize'=> $config->get(MainConfigNames::MaxShellFileSize),];$cgroup=$config->get(MainConfigNames::ShellCgroup);$restrictionMethod=$config->get(MainConfigNames::ShellRestrictionMethod);$factory=new CommandFactory( $services->getShellboxClientFactory(), $limits, $cgroup, $restrictionMethod);$factory->setLogger(LoggerFactory::getInstance( 'exec'));$factory->logStderr();return $factory;}, 'SignatureValidatorFactory'=> static function(MediaWikiServices $services):SignatureValidatorFactory { return new SignatureValidatorFactory(new ServiceOptions(SignatureValidator::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), static function() use( $services) { return $services->getParserFactory();}, $services->getSpecialPageFactory(), $services->getTitleFactory());}, 'SiteLookup'=> static function(MediaWikiServices $services):SiteLookup { return $services->getSiteStore();}, 'SiteStore'=> static function(MediaWikiServices $services):SiteStore { $rawSiteStore=new DBSiteStore( $services->getDBLoadBalancer());$cache=$services->getLocalServerObjectCache();if( $cache instanceof EmptyBagOStuff) { $cache=ObjectCache::getLocalClusterInstance();} return new CachingSiteStore( $rawSiteStore, $cache);}, 'SkinFactory'=> static function(MediaWikiServices $services):SkinFactory { $factory=new SkinFactory($services->getObjectFactory(),(array) $services->getMainConfig() ->get(MainConfigNames::SkipSkins));$names=$services->getMainConfig() ->get(MainConfigNames::ValidSkinNames);foreach( $names as $name=> $skin) { if(is_array( $skin)) { $spec=$skin;$displayName=$skin['displayname'] ?? $name;$skippable=$skin['skippable'] ?? null;} else { $displayName=$skin;$skippable=null;$spec=['name'=> $name, 'class'=> "Skin$skin"];} $factory->register( $name, $displayName, $spec, $skippable);} $factory->register( 'fallback', 'Fallback', ['class'=> SkinFallback::class, 'args'=>[['name'=> 'fallback', 'styles'=>[ 'mediawiki.skinning.interface'], 'templateDirectory'=> __DIR__ . '/skins/templates/fallback',]]], true);$factory->register( 'apioutput', 'ApiOutput', ['class'=> SkinApi::class, 'args'=>[['name'=> 'apioutput', 'styles'=>[ 'mediawiki.skinning.interface'], 'templateDirectory'=> __DIR__ . '/skins/templates/apioutput',]]], true);return $factory;}, 'SlotRoleRegistry'=> static function(MediaWikiServices $services):SlotRoleRegistry { $registry=new SlotRoleRegistry($services->getSlotRoleStore());$config=$services->getMainConfig();$contentHandlerFactory=$services->getContentHandlerFactory();$hookContainer=$services->getHookContainer();$titleFactory=$services->getTitleFactory();$registry->defineRole('main', static function() use( $config, $contentHandlerFactory, $hookContainer, $titleFactory) { return new MainSlotRoleHandler($config->get(MainConfigNames::NamespaceContentModels), $contentHandlerFactory, $hookContainer, $titleFactory);});return $registry;}, 'SlotRoleStore'=> static function(MediaWikiServices $services):NameTableStore { return $services->getNameTableStoreFactory() ->getSlotRoles();}, 'SpamChecker'=> static function(MediaWikiServices $services):SpamChecker { return new SpamChecker((array) $services->getMainConfig() ->get(MainConfigNames::SpamRegex),(array) $services->getMainConfig() ->get(MainConfigNames::SummarySpamRegex));}, 'SpecialPageFactory'=> static function(MediaWikiServices $services):SpecialPageFactory { return new SpecialPageFactory(new ServiceOptions(SpecialPageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), $services->getObjectFactory(), $services->getTitleFactory(), $services->getHookContainer());}, 'StatsdDataFactory'=> static function(MediaWikiServices $services):IBufferingStatsdDataFactory { return new BufferingStatsdDataFactory(rtrim( $services->getMainConfig() ->get(MainConfigNames::StatsdMetricPrefix), '.'));}, 'TalkPageNotificationManager'=> static function(MediaWikiServices $services):TalkPageNotificationManager { return new TalkPageNotificationManager(new ServiceOptions(TalkPageNotificationManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancer(), $services->getReadOnlyMode(), $services->getRevisionLookup(), $services->getHookContainer(), $services->getUserFactory());}, 'TempFSFileFactory'=> static function(MediaWikiServices $services):TempFSFileFactory { return new TempFSFileFactory( $services->getMainConfig() ->get(MainConfigNames::TmpDirectory));}, 'TempUserConfig'=> static function(MediaWikiServices $services):RealTempUserConfig { return new RealTempUserConfig($services->getMainConfig() ->get(MainConfigNames::AutoCreateTempUser));}, 'TempUserCreator'=> static function(MediaWikiServices $services):TempUserCreator { $accountCreationThrottle=$services->getMainConfig() ->get(MainConfigNames::AccountCreationThrottle);if(!is_array( $accountCreationThrottle)) { $accountCreationThrottle=[['count'=> $accountCreationThrottle, 'seconds'=> 86400,]];} return new TempUserCreator($services->getTempUserConfig(), $services->getObjectFactory(), $services->getUserFactory(), $services->getAuthManager(), new Throttler($accountCreationThrottle, ['type'=> 'acctcreate', 'cache'=> $services->getLocalServerObjectCache()]));}, 'Tidy'=> static function(MediaWikiServices $services):TidyDriverBase { return new RemexDriver(new ServiceOptions(RemexDriver::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'TitleFactory'=> static function(MediaWikiServices $services):TitleFactory { return new TitleFactory();}, 'TitleFormatter'=> static function(MediaWikiServices $services):TitleFormatter { return $services->getService( '_MediaWikiTitleCodec');}, 'TitleParser'=> static function(MediaWikiServices $services):TitleParser { return $services->getService( '_MediaWikiTitleCodec');}, 'TrackingCategories'=> static function(MediaWikiServices $services):TrackingCategories { return new TrackingCategories(new ServiceOptions(TrackingCategories::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getNamespaceInfo(), $services->getTitleParser(), LoggerFactory::getInstance( 'TrackingCategories'));}, 'UnblockUserFactory'=> static function(MediaWikiServices $services):UnblockUserFactory { return $services->getService( '_UserBlockCommandFactory');}, 'UndeletePageFactory'=> static function(MediaWikiServices $services):UndeletePageFactory { return $services->getService( '_PageCommandFactory');}, 'UploadRevisionImporter'=> static function(MediaWikiServices $services):UploadRevisionImporter { return new ImportableUploadRevisionImporter($services->getMainConfig() ->get(MainConfigNames::EnableUploads), LoggerFactory::getInstance( 'UploadRevisionImporter'));}, 'UrlUtils'=> static function(MediaWikiServices $services):UrlUtils { $config=$services->getMainConfig();return new UrlUtils([UrlUtils::SERVER=> $config->get(MainConfigNames::Server), UrlUtils::CANONICAL_SERVER=> $config->get(MainConfigNames::CanonicalServer), UrlUtils::INTERNAL_SERVER=> $config->get(MainConfigNames::InternalServer), UrlUtils::FALLBACK_PROTOCOL=> RequestContext::getMain() ->getRequest() ->getProtocol(), UrlUtils::HTTPS_PORT=> $config->get(MainConfigNames::HttpsPort), UrlUtils::VALID_PROTOCOLS=> $config->get(MainConfigNames::UrlProtocols),]);}, 'UserCache'=> static function(MediaWikiServices $services):UserCache { return new UserCache(LoggerFactory::getInstance( 'UserCache'), $services->getDBLoadBalancer(), $services->getLinkBatchFactory());}, 'UserEditTracker'=> static function(MediaWikiServices $services):UserEditTracker { return new UserEditTracker($services->getActorMigration(), $services->getDBLoadBalancer(), $services->getJobQueueGroup());}, 'UserFactory'=> static function(MediaWikiServices $services):UserFactory { return new UserFactory($services->getDBLoadBalancer(), $services->getUserNameUtils());}, 'UserGroupManager'=> static function(MediaWikiServices $services):UserGroupManager { return $services->getUserGroupManagerFactory() ->getUserGroupManager();}, 'UserGroupManagerFactory'=> static function(MediaWikiServices $services):UserGroupManagerFactory { return new UserGroupManagerFactory(new ServiceOptions(UserGroupManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getConfiguredReadOnlyMode(), $services->getDBLoadBalancerFactory(), $services->getHookContainer(), $services->getUserEditTracker(), $services->getGroupPermissionsLookup(), $services->getJobQueueGroupFactory(), LoggerFactory::getInstance( 'UserGroupManager'), $services->getTempUserConfig(), [static function(UserIdentity $user) use( $services) { $services->getPermissionManager() ->invalidateUsersRightsCache( $user);$services->getUserFactory() ->newFromUserIdentity( $user) ->invalidateCache();}]);}, 'UserIdentityLookup'=> static function(MediaWikiServices $services):UserIdentityLookup { return $services->getActorStoreFactory() ->getUserIdentityLookup();}, 'UserNamePrefixSearch'=> static function(MediaWikiServices $services):UserNamePrefixSearch { return new UserNamePrefixSearch($services->getDBLoadBalancer(), $services->getUserNameUtils());}, 'UserNameUtils'=> static function(MediaWikiServices $services):UserNameUtils { $messageFormatterFactory=new MessageFormatterFactory(Message::FORMAT_PLAIN);return new UserNameUtils(new ServiceOptions(UserNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), LoggerFactory::getInstance( 'UserNameUtils'), $services->getTitleParser(), $messageFormatterFactory->getTextFormatter($services->getContentLanguage() ->getCode()), $services->getHookContainer(), $services->getTempUserConfig());}, 'UserOptionsLookup'=> static function(MediaWikiServices $services):UserOptionsLookup { return $services->getUserOptionsManager();}, 'UserOptionsManager'=> static function(MediaWikiServices $services):UserOptionsManager { return new UserOptionsManager(new ServiceOptions(UserOptionsManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->get( '_DefaultOptionsLookup'), $services->getLanguageConverterFactory(), $services->getDBLoadBalancer(), LoggerFactory::getInstance( 'UserOptionsManager'), $services->getHookContainer(), $services->getUserFactory(), $services->getContentLanguage());}, 'VirtualRESTServiceClient'=> static function(MediaWikiServices $services):VirtualRESTServiceClient { $config=$services->getMainConfig() ->get(MainConfigNames::VirtualRestConfig);$vrsClient=new VirtualRESTServiceClient($services->getHttpRequestFactory() ->createMultiClient());foreach( $config['paths'] as $prefix=> $serviceConfig) { $class=$serviceConfig['class'];$constructArg=$serviceConfig['options'] ??[];$constructArg+=$config['global'];$vrsClient->mount( $prefix, [ 'class'=> $class, 'config'=> $constructArg]);} return $vrsClient;}, 'WatchedItemQueryService'=> static function(MediaWikiServices $services):WatchedItemQueryService { return new WatchedItemQueryService($services->getDBLoadBalancer(), $services->getCommentStore(), $services->getWatchedItemStore(), $services->getHookContainer(), $services->getUserOptionsLookup(), $services->getMainConfig() ->get(MainConfigNames::WatchlistExpiry), $services->getMainConfig() ->get(MainConfigNames::MaxExecutionTimeForExpensiveQueries));}, 'WatchedItemStore'=> static function(MediaWikiServices $services):WatchedItemStore { $store=new WatchedItemStore(new ServiceOptions(WatchedItemStore::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancerFactory(), $services->getJobQueueGroup(), $services->getMainObjectStash(), new HashBagOStuff([ 'maxKeys'=> 100]), $services->getReadOnlyMode(), $services->getNamespaceInfo(), $services->getRevisionLookup(), $services->getLinkBatchFactory());$store->setStatsdDataFactory( $services->getStatsdDataFactory());if( $services->getMainConfig() ->get(MainConfigNames::ReadOnlyWatchedItemStore)) { $store=new NoWriteWatchedItemStore( $store);} return $store;}, 'WatchlistManager'=> static function(MediaWikiServices $services):WatchlistManager { return new WatchlistManager(new ServiceOptions(WatchlistManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getHookContainer(), $services->getReadOnlyMode(), $services->getRevisionLookup(), $services->getTalkPageNotificationManager(), $services->getWatchedItemStore(), $services->getUserFactory(), $services->getNamespaceInfo(), $services->getWikiPageFactory());}, 'WikiExporterFactory'=> static function(MediaWikiServices $services):WikiExporterFactory { return new WikiExporterFactory($services->getHookContainer(), $services->getRevisionStore(), $services->getTitleParser());}, 'WikiImporterFactory'=> static function(MediaWikiServices $services):WikiImporterFactory { return new WikiImporterFactory($services->getMainConfig(), $services->getHookContainer(), $services->getContentLanguage(), $services->getNamespaceInfo(), $services->getTitleFactory(), $services->getWikiPageFactory(), $services->getWikiRevisionUploadImporter(), $services->getPermissionManager(), $services->getContentHandlerFactory(), $services->getSlotRoleRegistry());}, 'WikiPageFactory'=> static function(MediaWikiServices $services):WikiPageFactory { return new WikiPageFactory($services->getTitleFactory(), new HookRunner( $services->getHookContainer()), $services->getDBLoadBalancer());}, 'WikiRevisionOldRevisionImporterNoUpdates'=> static function(MediaWikiServices $services):ImportableOldRevisionImporter { return new ImportableOldRevisionImporter(false, LoggerFactory::getInstance( 'OldRevisionImporter'), $services->getDBLoadBalancer(), $services->getRevisionStore(), $services->getSlotRoleRegistry(), $services->getWikiPageFactory(), $services->getPageUpdaterFactory(), $services->getUserFactory());}, 'WRStatsFactory'=> static function(MediaWikiServices $services):WRStatsFactory { return new WRStatsFactory(new BagOStuffStatsStore(ObjectCache::getInstance( $services->getMainConfig() ->get(MainConfigNames::StatsCacheType))));}, '_DefaultOptionsLookup'=> static function(MediaWikiServices $services):DefaultOptionsLookup { return new DefaultOptionsLookup(new ServiceOptions(DefaultOptionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), $services->getHookContainer(), $services->getNamespaceInfo());}, '_EditConstraintFactory'=> static function(MediaWikiServices $services):EditConstraintFactory { return new EditConstraintFactory(new ServiceOptions(EditConstraintFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), LoggerFactory::getProvider(), $services->getPermissionManager(), $services->getHookContainer(), $services->getReadOnlyMode(), $services->getSpamChecker());}, '_MediaWikiTitleCodec'=> static function(MediaWikiServices $services):MediaWikiTitleCodec { return new MediaWikiTitleCodec($services->getContentLanguage(), $services->getGenderCache(), $services->getMainConfig() ->get(MainConfigNames::LocalInterwikis), $services->getInterwikiLookup(), $services->getNamespaceInfo());}, '_PageCommandFactory'=> static function(MediaWikiServices $services):PageCommandFactory { return new PageCommandFactory($services->getMainConfig(), $services->getDBLoadBalancerFactory(), $services->getNamespaceInfo(), $services->getWatchedItemStore(), $services->getRepoGroup(), $services->getReadOnlyMode(), $services->getContentHandlerFactory(), $services->getRevisionStore(), $services->getSpamChecker(), $services->getTitleFormatter(), $services->getHookContainer(), $services->getWikiPageFactory(), $services->getUserFactory(), $services->getActorMigration(), $services->getActorNormalization(), $services->getTitleFactory(), $services->getUserEditTracker(), $services->getCollationFactory(), $services->getJobQueueGroup(), $services->getCommentStore(), $services->getMainObjectStash(), WikiMap::getCurrentWikiDbDomain() ->getId(), WebRequest::getRequestId(), $services->getBacklinkCacheFactory(), LoggerFactory::getInstance( 'UndeletePage'), $services->getPageUpdaterFactory(), $services->getMessageFormatterFactory() ->getTextFormatter($services->getContentLanguage() ->getCode()), $services->getArchivedRevisionLookup(), $services->getRestrictionStore());}, '_ParserObserver'=> static function(MediaWikiServices $services):ParserObserver { return new ParserObserver(LoggerFactory::getInstance( 'DuplicateParse'));}, '_Parsoid'=> static function(MediaWikiServices $services):Parsoid { return new Parsoid($services->getParsoidSiteConfig(), $services->getParsoidDataAccess());}, '_SqlBlobStore'=> static function(MediaWikiServices $services):SqlBlobStore { return $services->getBlobStoreFactory() ->newSqlBlobStore();}, '_UserBlockCommandFactory'=> static function(MediaWikiServices $services):UserBlockCommandFactory { return new UserBlockCommandFactory(new ServiceOptions(UserBlockCommandFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getHookContainer(), $services->getBlockPermissionCheckerFactory(), $services->getBlockUtils(), $services->getDatabaseBlockStore(), $services->getBlockRestrictionStore(), $services->getUserFactory(), $services->getUserEditTracker(), LoggerFactory::getInstance( 'BlockManager'), $services->getTitleFactory(), $services->getBlockActionInfo());},]
@phpcs-require-sorted-array
$wgSettings
Definition Setup.php:143
This is not intended to be a long-term part of MediaWiki; it will be deprecated and removed once acto...
Class representing a cache/ephemeral data store.
Definition BagOStuff.php:85
get( $key, $flags=0)
Get an item.
MediaWiki adaption of StatsdDataFactory that provides buffering and metric prefixing.
The CentralIdLookup service allows for connecting local users with cluster-wide IDs.
static getSoftwareTags( $all=false)
Loads defined core tags, checks for invalid types (if not array), and filters for supported and enabl...
Handle database storage of comments such as edit summaries and log reasons.
Factory class to create Config objects.
A read-only mode service which does not depend on LoadBalancer.
Support for detecting/validating DjVu image files and getting some basic file metadata (resolution et...
Definition DjVuImage.php:41
A BagOStuff object with no objects in it.
Factory class for spawning EventRelayer objects using configuration.
The Registry loads JSON files, and uses a Processor to extract information from them.
This is the main interface for fetching or inserting objects with ExternalStore.
Class to handle file backend registration.
Caches user genders when needed to use correct namespace aliases.
Simple store for keeping values in an associative array for the current process.
Class to invalidate the CDN and HTMLFileCache entries associated with URLs/titles.
Class to handle enqueueing of background jobs.
Job queue runner utility methods.
Definition JobRunner.php:43
Methods for dealing with language codes.
Base class for language-specific code.
Definition Language.php:53
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition LinkCache.php:42
Caching for the contents of localisation files.
static getStoreFromConf(array $conf, $fallbackCacheDir)
Return a suitable LCStore as specified by the given configuration.
MediaWiki-specific class for generating database load balancers.
A factory that stores information about MagicWords, and creates them on demand with caching.
Class to construct MediaHandler objects.
A codec for MediaWiki page titles.
This serves as the entry point to the authentication system.
setLogger(LoggerInterface $logger)
Defines the actions that can be blocked by a partial block.
A service class for getting formatted information about a block.
A service class for checking blocks.
Backend class for blocking utils.
Common factory to construct collation classes.
This is the main service interface for converting single-line comments from various DB comment fields...
This is basically a CommentFormatter with a CommentStore dependency, allowing it to retrieve comment ...
Object which holds currently registered configuration options.
A class for passing options to services.
Constraints reflect possible errors that need to be checked.
Service to check if text (either content or a summary) qualifies as spam.
Factory service for WikiExporter instances.
A HookRegistry which sources its data from dynamically changing sources: $wgHooks and an ExtensionReg...
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
Factory creating MWHttpRequest objects.
InterwikiLookup implementing the "classic" interwiki storage (hardcoded up to MW 1....
Class to construct JobQueueGroups.
An interface for creating language converters.
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
A service that provides utilities to do with language names and codes.
Factory to create LinkRender objects.
Class that generates HTML anchor link elements for pages.
Service for retrieving and storing link targets.
Service for compat reading of links tables.
PSR-3 logger instance factory.
A class containing constants representing the names of configuration variables.
Service locator for MediaWiki core services.
The MediaWiki-specific implementation of IMessageFormatterFactory.
Implementation of various page action services.
Service for getting rendered output of a given page.
Service for storing and retreiving page redirect information.
Service for creating WikiPage objects.
Implement Parsoid's abstract class for data access.
Helper class used by MediaWiki to create Parsoid PageConfig objects.
Site-level configuration for Parsoid.
MediaWiki service for getting Parsoid Output objects.
Users can authorize applications to use their account via OAuth.
This separate service is needed because the ::getGrantsLink method requires a LinkRenderer and if we ...
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...
Provides rate limiting for a set of actions based on several counter buckets.
This is the default implementation of PreferencesFactory.
This class generates message blobs for use by ResourceLoader.
ResourceLoader is a loading system for JavaScript and CSS resources.
A SlotRoleHandler for the main slot.
The RevisionRenderer service provides access to rendered output for revisions.
setLogger(LoggerInterface $saveParseLogger)
Factory service for RevisionStore instances.
Service for looking up page revisions.
A registry service for SlotRoleHandlers, used to define which slot roles are available on which page.
defineRole( $role, callable $instantiator)
Defines a slot role.
Factory facilitating dependency injection for Command.
This is a service which provides a configured client to access a remote Shellbox installation.
Factory for handling the special page list and generating SpecialPage objects.
Service for instantiating BlobStores.
Class allowing easy storage and retrieval of EditResults associated with revisions.
Manage the pre-emptive page parsing for edits to wiki pages.
A factory for PageUpdater instances.
Class for managing delayed RevertedTagUpdateJob waiting for user approval.
Service for storing and loading Content objects.
Base class for HTML cleanup utilities.
A service class to control default user options.
The real TempUserConfig including internal methods used by TempUserCreator.
Service for temporary user creation.
Track info about user edit counts and timings.
Creates User objects.
Factory service for UserGroupManager instances.
Handles searching prefixes of user names.
UserNameUtils service.
Provides access to user options.
A service class to control user options.
A service to expand, parse, and otherwise manipulate URLs.
Definition UrlUtils.php:17
Cache messages that are defined by MediaWiki-namespace pages or by hooks.
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:140
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Functions to get cache objects.
static newFromParams(array $params, Config $conf=null)
Create a new cache object from parameters.
static getInstance( $id)
Get a cached instance of the specified type of cache object.
static getLocalClusterInstance()
Get the main cluster-local cache object.
Gives access to properties of a page.
Definition PageProps.php:33
Cache for ParserOutput objects corresponding to the latest page revisions.
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Definition Parser.php:96
Factory class for creating and checking Password objects.
Helper class for the password reset functionality shared by the web UI and the API.
Proxy to prefix metric keys sent to a StatsdDataFactoryInterface.
A service class for fetching the wiki's current read-only mode.
Prioritized list of file repositories.
Definition RepoGroup.php:29
Group all the pieces relevant to the context of a request into one instance.
Configuration handling class for SearchEngine.
Factory class for SearchEngine.
Factory class to create Skin objects.
register( $name, $displayName, $spec, bool $skippable=null)
Register a new skin.
Creates Title objects.
This class performs some operations related to tracking categories, such as creating a list of all su...
Virtual HTTP service client loosely styled after a Virtual File System.
Multi-datacenter aware caching interface.
get( $key, &$curTTL=null, array $checkKeys=[], &$info=[])
Fetch the value of a key from cache.
static newEmpty()
Get an instance that wraps EmptyBagOStuff.
Storage layer class for WatchedItems.
setStatsdDataFactory(StatsdDataFactoryInterface $stats)
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
Factory service for WikiImporter instances.
Helper tools for dealing with other locally-hosted wikis.
Definition WikiMap.php:29
static getWikiIdFromDbDomain( $domain)
Get the wiki ID of a database domain.
Definition WikiMap.php:269
static getCurrentWikiDbDomain()
Definition WikiMap.php:293
Track per-module file dependencies in object cache via BagOStuff.
Track per-module file dependencies in the core module_deps table.
Constructs Database objects.
Class for getting statistically unique IDs without a central coordinator.
An adaptor allowing WRStats to store data in MediaWiki's BagOStuff.
A factory for WRStats readers and writers.
Interface for configuration instances.
Definition Config.php:30
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
Marker interface for entities aware of the wiki they belong to.
Interface for saving and retrieval of Parsoid HTML and Parsoid metadata from storage.
Service interface for looking up Interwiki records.
Interface for sending emails.
Definition IEmailer.php:34
Service for changing the content model of wiki pages.
Service for page delete actions.
Service for mergehistory actions.
Service for page rename actions.
Service for resolving a wiki page redirect.
Service for page rollback actions.
Service for page undelete actions.
A PreferencesFactory is a MediaWiki service that provides the definitions of preferences for a given ...
Service for constructing RevisionRecord objects.
Service for looking up page revisions.
Represents a config schema.
Service for loading and storing data blobs.
Definition BlobStore.php:35
Service for dealing with the actor table.
Interface for objects representing user identity.
A title formatter service for MediaWiki.
A title parser service for MediaWiki.
A simple factory providing a message formatter for a given language code.
$command
Definition mcc.php:125
$cache
Definition mcc.php:33
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
return true
Definition router.php:92
$mime
Definition router.php:60
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition router.php:42
if(!is_readable( $file)) $ext
Definition router.php:48