MediaWiki REL1_37
ServiceWiring.php
Go to the documentation of this file.
1<?php
47use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
152use Wikimedia\ObjectFactory;
153use Wikimedia\RequestTimeout\CriticalSectionProvider;
154use Wikimedia\RequestTimeout\RequestTimeout;
155use Wikimedia\Services\RecursiveServiceDependencyException;
157
159return [
160 'ActionFactory' => static function ( MediaWikiServices $services ): ActionFactory {
162 $services->getMainConfig()->get( 'Actions' ),
163 LoggerFactory::getInstance( 'ActionFactory' ),
164 $services->getObjectFactory(),
165 $services->getHookContainer()
166 );
167 },
168
169 'ActorMigration' => static function ( MediaWikiServices $services ): ActorMigration {
171 $services->getMainConfig()->get( 'ActorTableSchemaMigrationStage' ),
172 $services->getActorStoreFactory()
173 );
174 },
175
176 'ActorNormalization' => static function ( MediaWikiServices $services ): ActorNormalization {
177 return $services->getActorStoreFactory()->getActorNormalization();
178 },
179
180 'ActorStore' => static function ( MediaWikiServices $services ): ActorStore {
181 return $services->getActorStoreFactory()->getActorStore();
182 },
183
184 'ActorStoreFactory' => static function ( MediaWikiServices $services ): ActorStoreFactory {
186 new ServiceOptions( ActorStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
187 $services->getDBLoadBalancerFactory(),
188 $services->getUserNameUtils(),
189 LoggerFactory::getInstance( 'ActorStore' )
190 );
191 },
192
193 'AuthManager' => static function ( MediaWikiServices $services ): AuthManager {
194 $authManager = new AuthManager(
195 RequestContext::getMain()->getRequest(),
196 $services->getMainConfig(),
197 $services->getObjectFactory(),
198 $services->getHookContainer(),
199 $services->getReadOnlyMode(),
200 $services->getUserNameUtils(),
201 $services->getBlockManager(),
202 $services->getWatchlistManager(),
203 $services->getDBLoadBalancer(),
204 $services->getContentLanguage(),
205 $services->getLanguageConverterFactory(),
206 $services->getBotPasswordStore(),
207 $services->getUserFactory(),
208 $services->getUserIdentityLookup(),
209 $services->getUserOptionsManager()
210 );
211 $authManager->setLogger( LoggerFactory::getInstance( 'authentication' ) );
212 return $authManager;
213 },
214
215 'BacklinkCacheFactory' => static function ( MediaWikiServices $services ): BacklinkCacheFactory {
216 return new BacklinkCacheFactory( $services->getMainWANObjectCache() );
217 },
218
219 'BadFileLookup' => static function ( MediaWikiServices $services ): BadFileLookup {
221 static function () {
222 return wfMessage( 'bad_image_list' )->inContentLanguage()->plain();
223 },
224 $services->getLocalServerObjectCache(),
225 $services->getRepoGroup(),
226 $services->getTitleParser(),
227 $services->getHookContainer()
228 );
229 },
230
231 'BlobStore' => static function ( MediaWikiServices $services ): BlobStore {
232 return $services->getService( '_SqlBlobStore' );
233 },
234
235 'BlobStoreFactory' => static function ( MediaWikiServices $services ): BlobStoreFactory {
237 $services->getDBLoadBalancerFactory(),
238 $services->getExternalStoreAccess(),
239 $services->getMainWANObjectCache(),
240 new ServiceOptions( BlobStoreFactory::CONSTRUCTOR_OPTIONS,
241 $services->getMainConfig() )
242 );
243 },
244
245 'BlockActionInfo' => static function ( MediaWikiServices $services ): BlockActionInfo {
246 return new BlockActionInfo( $services->getHookContainer() );
247 },
248
249 'BlockErrorFormatter' => static function ( MediaWikiServices $services ): BlockErrorFormatter {
251 $services->getTitleFormatter()
252 );
253 },
254
255 'BlockManager' => static function ( MediaWikiServices $services ): BlockManager {
257 new ServiceOptions(
258 BlockManager::CONSTRUCTOR_OPTIONS,
259 $services->getMainConfig()
260 ),
261 $services->getPermissionManager(),
262 $services->getUserFactory(),
263 LoggerFactory::getInstance( 'BlockManager' ),
264 $services->getHookContainer()
265 );
266 },
267
268 'BlockPermissionCheckerFactory' => static function (
269 MediaWikiServices $services
272 new ServiceOptions(
273 BlockPermissionCheckerFactory::CONSTRUCTOR_OPTIONS,
274 $services->getMainConfig()
275 ),
276 $services->getBlockUtils()
277 );
278 },
279
280 'BlockRestrictionStore' => static function ( MediaWikiServices $services ): BlockRestrictionStore {
282 $services->getDBLoadBalancer()
283 );
284 },
285
286 'BlockUserFactory' => static function ( MediaWikiServices $services ): BlockUserFactory {
287 return $services->getService( '_UserBlockCommandFactory' );
288 },
289
290 'BlockUtils' => static function ( MediaWikiServices $services ): BlockUtils {
291 return new BlockUtils(
292 new ServiceOptions(
293 BlockUtils::CONSTRUCTOR_OPTIONS,
294 $services->getMainConfig()
295 ),
296 $services->getUserIdentityLookup(),
297 $services->getUserNameUtils()
298 );
299 },
300
301 'BotPasswordStore' => static function ( MediaWikiServices $services ): BotPasswordStore {
303 new ServiceOptions(
304 BotPasswordStore::CONSTRUCTOR_OPTIONS,
305 $services->getMainConfig()
306 ),
307 $services->getCentralIdLookup(),
308 $services->getDBLoadBalancerFactory()
309 );
310 },
311
312 'CentralIdLookup' => static function ( MediaWikiServices $services ): CentralIdLookup {
313 return $services->getCentralIdLookupFactory()->getLookup();
314 },
315
316 'CentralIdLookupFactory' => static function ( MediaWikiServices $services ): CentralIdLookupFactory {
318 new ServiceOptions( CentralIdLookupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
319 $services->getObjectFactory(),
320 $services->getUserIdentityLookup()
321 );
322 },
323
324 'ChangeTagDefStore' => static function ( MediaWikiServices $services ): NameTableStore {
325 return $services->getNameTableStoreFactory()->getChangeTagDef();
326 },
327
328 'CollationFactory' => static function ( MediaWikiServices $services ): CollationFactory {
330 new ServiceOptions(
331 CollationFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
332 $services->getObjectFactory(),
333 $services->getHookContainer()
334 );
335 },
336
337 'CommentStore' => static function ( MediaWikiServices $services ): CommentStore {
339 $services->getContentLanguage(),
341 );
342 },
343
344 'ConfigFactory' => static function ( MediaWikiServices $services ): ConfigFactory {
345 // Use the bootstrap config to initialize the ConfigFactory.
346 $registry = $services->getBootstrapConfig()->get( 'ConfigRegistry' );
347 $factory = new ConfigFactory();
348
349 foreach ( $registry as $name => $callback ) {
350 $factory->register( $name, $callback );
351 }
352 return $factory;
353 },
354
355 'ConfigRepository' => static function ( MediaWikiServices $services ): ConfigRepository {
356 return new ConfigRepository( $services->getConfigFactory() );
357 },
358
359 'ConfiguredReadOnlyMode' => static function ( MediaWikiServices $services ): ConfiguredReadOnlyMode {
360 $config = $services->getMainConfig();
361 return new ConfiguredReadOnlyMode(
362 $config->get( 'ReadOnly' ),
363 $config->get( 'ReadOnlyFile' )
364 );
365 },
366
367 'ContentHandlerFactory' => static function ( MediaWikiServices $services ): IContentHandlerFactory {
368 $contentHandlerConfig = $services->getMainConfig()->get( 'ContentHandlers' );
369
370 return new ContentHandlerFactory(
371 $contentHandlerConfig,
372 $services->getObjectFactory(),
373 $services->getHookContainer(),
374 LoggerFactory::getInstance( 'ContentHandler' )
375 );
376 },
377
378 'ContentLanguage' => static function ( MediaWikiServices $services ): Language {
379 return $services->getLanguageFactory()->getLanguage(
380 $services->getMainConfig()->get( 'LanguageCode' ) );
381 },
382
383 'ContentModelChangeFactory' => static function ( MediaWikiServices $services ): ContentModelChangeFactory {
384 return $services->getService( '_PageCommandFactory' );
385 },
386
387 'ContentModelStore' => static function ( MediaWikiServices $services ): NameTableStore {
388 return $services->getNameTableStoreFactory()->getContentModels();
389 },
390
391 'ContentTransformer' => static function ( MediaWikiServices $services ): ContentTransformer {
392 return new ContentTransformer( $services->getContentHandlerFactory() );
393 },
394
395 'ContributionsLookup' => static function ( MediaWikiServices $services ): ContributionsLookup {
397 $services->getRevisionStore(),
398 $services->getLinkRendererFactory(),
399 $services->getLinkBatchFactory(),
400 $services->getHookContainer(),
401 $services->getDBLoadBalancer(),
402 $services->getActorMigration(),
403 $services->getNamespaceInfo()
404 );
405 },
406
407 'CriticalSectionProvider' => static function ( MediaWikiServices $services ): CriticalSectionProvider {
408 $config = $services->getMainConfig();
409 $limit = $config->get( 'CommandLineMode' ) ? INF : $config->get( 'CriticalSectionTimeLimit' );
410 return RequestTimeout::singleton()->createCriticalSectionProvider( $limit );
411 },
412
413 'CryptHKDF' => static function ( MediaWikiServices $services ): CryptHKDF {
414 $config = $services->getMainConfig();
415
416 $secret = $config->get( 'HKDFSecret' ) ?: $config->get( 'SecretKey' );
417 if ( !$secret ) {
418 throw new RuntimeException( "Cannot use MWCryptHKDF without a secret." );
419 }
420
421 // In HKDF, the context can be known to the attacker, but this will
422 // keep simultaneous runs from producing the same output.
423 $context = [ microtime(), getmypid(), gethostname() ];
424
425 // Setup salt cache. Use APC, or fallback to the main cache if it isn't setup
426 $cache = $services->getLocalServerObjectCache();
427 if ( $cache instanceof EmptyBagOStuff ) {
429 }
430
431 return new CryptHKDF( $secret, $config->get( 'HKDFAlgorithm' ), $cache, $context );
432 },
433
434 'DatabaseBlockStore' => static function ( MediaWikiServices $services ): DatabaseBlockStore {
436 new ServiceOptions(
437 DatabaseBlockStore::CONSTRUCTOR_OPTIONS,
438 $services->getMainConfig()
439 ),
440 LoggerFactory::getInstance( 'DatabaseBlockStore' ),
441 $services->getActorStoreFactory(),
442 $services->getBlockRestrictionStore(),
443 $services->getCommentStore(),
444 $services->getHookContainer(),
445 $services->getDBLoadBalancer(),
446 $services->getReadOnlyMode(),
447 $services->getUserFactory()
448 );
449 },
450
451 'DateFormatterFactory' => static function ( MediaWikiServices $services ): DateFormatterFactory {
453 },
454
455 'DBLoadBalancer' => static function ( MediaWikiServices $services ): Wikimedia\Rdbms\ILoadBalancer {
456 // just return the default LB from the DBLoadBalancerFactory service
457 return $services->getDBLoadBalancerFactory()->getMainLB();
458 },
459
460 'DBLoadBalancerFactory' =>
461 static function ( MediaWikiServices $services ): Wikimedia\Rdbms\LBFactory {
462 $mainConfig = $services->getMainConfig();
463
464 $cpStashType = $mainConfig->get( 'ChronologyProtectorStash' );
465 if ( is_string( $cpStashType ) ) {
466 $cpStash = ObjectCache::getInstance( $cpStashType );
467 } else {
468 try {
470 } catch ( RecursiveServiceDependencyException $e ) {
471 $cpStash = new EmptyBagOStuff(); // T141804: handle cases like CACHE_DB
472 }
473 }
474 LoggerFactory::getInstance( 'DBReplication' )->debug(
475 'ChronologyProtector using store {class}',
476 [ 'class' => get_class( $cpStash ) ]
477 );
478
479 try {
480 $wanCache = $services->getMainWANObjectCache();
481 } catch ( RecursiveServiceDependencyException $e ) {
482 $wanCache = WANObjectCache::newEmpty(); // T141804: handle cases like CACHE_DB
483 }
484
485 $srvCache = $services->getLocalServerObjectCache();
486 if ( $srvCache instanceof EmptyBagOStuff ) {
487 // Use process cache if no APCU or other local-server cache (e.g. on CLI)
488 $srvCache = new HashBagOStuff( [ 'maxKeys' => 100 ] );
489 }
490
492 $mainConfig->get( 'LBFactoryConf' ),
494 $services->getConfiguredReadOnlyMode(),
495 $cpStash,
496 $srvCache,
497 $wanCache,
498 $services->getCriticalSectionProvider()
499 );
500
501 $class = MWLBFactory::getLBFactoryClass( $lbConf );
502 $instance = new $class( $lbConf );
503
505
506 // NOTE: This accesses ProxyLookup from the MediaWikiServices singleton
507 // for non-essential non-nonimal purposes (via WebRequest::getIP).
508 // This state is fine (and meant) to be consistent for a given PHP process,
509 // even if applied to the service container for a different wiki.
511 $instance,
512 $mainConfig,
513 $services->getStatsdDataFactory()
514 );
515
516 return $instance;
517 },
518
519 'DeletePageFactory' => static function ( MediaWikiServices $services ): DeletePageFactory {
520 return $services->getService( '_PageCommandFactory' );
521 },
522
523 'Emailer' => static function ( MediaWikiServices $services ): IEmailer {
524 return new Emailer();
525 },
526
527 'EventRelayerGroup' => static function ( MediaWikiServices $services ): EventRelayerGroup {
528 return new EventRelayerGroup( $services->getMainConfig()->get( 'EventRelayerConfig' ) );
529 },
530
531 'ExternalStoreAccess' => static function ( MediaWikiServices $services ): ExternalStoreAccess {
533 $services->getExternalStoreFactory(),
534 LoggerFactory::getInstance( 'ExternalStore' )
535 );
536 },
537
538 'ExternalStoreFactory' => static function ( MediaWikiServices $services ): ExternalStoreFactory {
539 $config = $services->getMainConfig();
540 $writeStores = $config->get( 'DefaultExternalStore' );
541
542 return new ExternalStoreFactory(
543 $config->get( 'ExternalStores' ),
544 ( $writeStores !== false ) ? (array)$writeStores : [],
545 $services->getDBLoadBalancer()->getLocalDomainID(),
546 LoggerFactory::getInstance( 'ExternalStore' )
547 );
548 },
549
550 'FileBackendGroup' => static function ( MediaWikiServices $services ): FileBackendGroup {
551 $mainConfig = $services->getMainConfig();
552
554 $fallbackWikiId = WikiMap::getWikiIdFromDbDomain( $ld );
555 // If the local wiki ID and local domain ID do not match, probably due to a non-default
556 // schema, issue a warning. A non-default schema indicates that it might be used to
557 // disambiguate different wikis.
558 $legacyDomainId = strlen( $ld->getTablePrefix() )
559 ? "{$ld->getDatabase()}-{$ld->getTablePrefix()}"
560 : $ld->getDatabase();
561 if ( $ld->getSchema() !== null && $legacyDomainId !== $fallbackWikiId ) {
562 wfWarn(
563 "Legacy default 'domainId' is '$legacyDomainId' but wiki ID is '$fallbackWikiId'."
564 );
565 }
566
567 $cache = $services->getLocalServerObjectCache();
568 if ( $cache instanceof EmptyBagOStuff ) {
569 $cache = new HashBagOStuff();
570 }
571
572 return new FileBackendGroup(
573 new ServiceOptions( FileBackendGroup::CONSTRUCTOR_OPTIONS, $mainConfig,
574 [ 'fallbackWikiId' => $fallbackWikiId ] ),
575 $services->getConfiguredReadOnlyMode(),
576 $cache,
577 $services->getMainWANObjectCache(),
578 $services->getMimeAnalyzer(),
579 $services->getLockManagerGroupFactory(),
580 $services->getTempFSFileFactory(),
581 $services->getObjectFactory()
582 );
583 },
584
585 'GenderCache' => static function ( MediaWikiServices $services ): GenderCache {
586 $nsInfo = $services->getNamespaceInfo();
587 // Database layer may be disabled, so processing without database connection
588 $dbLoadBalancer = $services->isServiceDisabled( 'DBLoadBalancer' )
589 ? null
590 : $services->getDBLoadBalancer();
591 return new GenderCache( $nsInfo, $dbLoadBalancer, $services->get( '_DefaultOptionsLookup' ) );
592 },
593
594 'GlobalIdGenerator' => static function ( MediaWikiServices $services ): GlobalIdGenerator {
595 $mainConfig = $services->getMainConfig();
596
597 return new GlobalIdGenerator(
598 $mainConfig->get( 'TmpDirectory' ),
599 static function ( $command ) {
600 return wfShellExec( $command );
601 }
602 );
603 },
604
605 'GroupPermissionsLookup' => static function ( MediaWikiServices $services ): GroupPermissionsLookup {
607 new ServiceOptions( GroupPermissionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig() )
608 );
609 },
610
611 'HookContainer' => static function ( MediaWikiServices $services ): HookContainer {
612 $extRegistry = ExtensionRegistry::getInstance();
613 $extDeprecatedHooks = $extRegistry->getAttribute( 'DeprecatedHooks' );
614 $deprecatedHooks = new DeprecatedHooks( $extDeprecatedHooks );
615 $hookRegistry = new GlobalHookRegistry( $extRegistry, $deprecatedHooks );
616 return new HookContainer(
617 $hookRegistry,
618 $services->getObjectFactory()
619 );
620 },
621
622 'HtmlCacheUpdater' => static function ( MediaWikiServices $services ): HtmlCacheUpdater {
623 $config = $services->getMainConfig();
624
625 return new HtmlCacheUpdater(
626 $services->getHookContainer(),
627 $services->getTitleFactory(),
628 $config->get( 'CdnReboundPurgeDelay' ),
629 $config->get( 'UseFileCache' ),
630 $config->get( 'CdnMaxAge' )
631 );
632 },
633
634 'HttpRequestFactory' =>
635 static function ( MediaWikiServices $services ): HttpRequestFactory {
637 new ServiceOptions(
638 HttpRequestFactory::CONSTRUCTOR_OPTIONS,
639 $services->getMainConfig()
640 ),
641 LoggerFactory::getInstance( 'http' )
642 );
643 },
644
645 'InterwikiLookup' => static function ( MediaWikiServices $services ): InterwikiLookup {
646 $config = $services->getMainConfig();
647 return new ClassicInterwikiLookup(
648 $services->getContentLanguage(),
649 $services->getMainWANObjectCache(),
650 $services->getHookContainer(),
651 $services->getDBLoadBalancer(),
652 $config->get( 'InterwikiExpiry' ),
653 $config->get( 'InterwikiCache' ),
654 $config->get( 'InterwikiScopes' ),
655 $config->get( 'InterwikiFallbackSite' )
656 );
657 },
658
659 'JobQueueGroup' => static function ( MediaWikiServices $services ): JobQueueGroup {
660 return $services->getJobQueueGroupFactory()->makeJobQueueGroup();
661 },
662
663 'JobQueueGroupFactory' => static function ( MediaWikiServices $services ): JobQueueGroupFactory {
665 new ServiceOptions( JobQueueGroupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
666 $services->getConfiguredReadOnlyMode(),
667 $services->getStatsdDataFactory(),
668 $services->getMainWANObjectCache(),
669 $services->getGlobalIdGenerator()
670 );
671 },
672
673 'JobRunner' => static function ( MediaWikiServices $services ): JobRunner {
674 return new JobRunner(
675 new ServiceOptions( JobRunner::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
676 $services->getDBLoadBalancerFactory(),
677 $services->getJobQueueGroup(),
678 $services->getReadOnlyMode(),
679 $services->getLinkCache(),
680 $services->getStatsdDataFactory(),
681 LoggerFactory::getInstance( 'runJobs' )
682 );
683 },
684
685 'JsonCodec' => static function ( MediaWikiServices $services ): JsonCodec {
686 return new JsonCodec();
687 },
688
689 'LanguageConverterFactory' => static function ( MediaWikiServices $services ): LanguageConverterFactory {
690 $usePigLatinVariant = $services->getMainConfig()->get( 'UsePigLatinVariant' );
691 $isConversionDisabled = $services->getMainConfig()->get( 'DisableLangConversion' );
692 $isTitleConversionDisabled = $services->getMainConfig()->get( 'DisableTitleConversion' );
693 return new LanguageConverterFactory(
694 $usePigLatinVariant,
695 $isConversionDisabled,
696 $isTitleConversionDisabled,
697 static function () use ( $services ) {
698 return $services->getContentLanguage();
699 }
700 );
701 },
702
703 'LanguageFactory' => static function ( MediaWikiServices $services ): LanguageFactory {
705 new ServiceOptions( LanguageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
706 $services->getLocalisationCache(),
707 $services->getLanguageNameUtils(),
708 $services->getLanguageFallback(),
709 $services->getLanguageConverterFactory(),
710 $services->getHookContainer()
711 );
712 },
713
714 'LanguageFallback' => static function ( MediaWikiServices $services ): LanguageFallback {
716 $services->getMainConfig()->get( 'LanguageCode' ),
717 $services->getLocalisationCache(),
718 $services->getLanguageNameUtils()
719 );
720 },
721
722 'LanguageNameUtils' => static function ( MediaWikiServices $services ): LanguageNameUtils {
724 new ServiceOptions(
725 LanguageNameUtils::CONSTRUCTOR_OPTIONS,
726 $services->getMainConfig()
727 ),
728 $services->getHookContainer()
729 );
730 },
731
732 'LinkBatchFactory' => static function ( MediaWikiServices $services ): LinkBatchFactory {
734 $services->getLinkCache(),
735 $services->getTitleFormatter(),
736 $services->getContentLanguage(),
737 $services->getGenderCache(),
738 $services->getDBLoadBalancer()
739 );
740 },
741
742 'LinkCache' => static function ( MediaWikiServices $services ): LinkCache {
743 // Database layer may be disabled, so processing without database connection
744 $dbLoadBalancer = $services->isServiceDisabled( 'DBLoadBalancer' )
745 ? null
746 : $services->getDBLoadBalancer();
747 $linkCache = new LinkCache(
748 $services->getTitleFormatter(),
749 $services->getMainWANObjectCache(),
750 $services->getNamespaceInfo(),
751 $dbLoadBalancer
752 );
753 $linkCache->setLogger( LoggerFactory::getInstance( 'LinkCache' ) );
754 return $linkCache;
755 },
756
757 'LinkRenderer' => static function ( MediaWikiServices $services ): LinkRenderer {
758 return $services->getLinkRendererFactory()->create();
759 },
760
761 'LinkRendererFactory' => static function ( MediaWikiServices $services ): LinkRendererFactory {
763 $services->getTitleFormatter(),
764 $services->getLinkCache(),
765 $services->getNamespaceInfo(),
766 $services->getSpecialPageFactory(),
767 $services->getHookContainer()
768 );
769 },
770
771 'LocalisationCache' => static function ( MediaWikiServices $services ): LocalisationCache {
772 $conf = $services->getMainConfig()->get( 'LocalisationCacheConf' );
773
774 $logger = LoggerFactory::getInstance( 'localisation' );
775
777 $conf, $services->getMainConfig()->get( 'CacheDirectory' ) );
778 $logger->debug( 'LocalisationCache using store ' . get_class( $store ) );
779
780 return new $conf['class'](
781 new ServiceOptions(
782 LocalisationCache::CONSTRUCTOR_OPTIONS,
783 // Two of the options are stored in $wgLocalisationCacheConf
784 $conf,
785 // In case someone set that config variable and didn't reset all keys, set defaults.
786 [
787 'forceRecache' => false,
788 'manualRecache' => false,
789 ],
790 // Some other options come from config itself
791 $services->getMainConfig()
792 ),
793 $store,
794 $logger,
795 [ static function () use ( $services ) {
796 // NOTE: Make sure we use the same cache object that is assigned in the
797 // constructor of the MessageBlobStore class used by ResourceLoader.
798 // T231866: Avoid circular dependency via ResourceLoader.
799 MessageBlobStore::clearGlobalCacheEntry( $services->getMainWANObjectCache() );
800 } ],
801 $services->getLanguageNameUtils(),
802 $services->getHookContainer()
803 );
804 },
805
806 'LocalServerObjectCache' => static function ( MediaWikiServices $services ): BagOStuff {
807 return ObjectCache::makeLocalServerCache();
808 },
809
810 'LockManagerGroupFactory' => static function ( MediaWikiServices $services ): LockManagerGroupFactory {
812 WikiMap::getCurrentWikiDbDomain()->getId(),
813 $services->getMainConfig()->get( 'LockManagers' ),
814 $services->getDBLoadBalancerFactory()
815 );
816 },
817
818 'MagicWordFactory' => static function ( MediaWikiServices $services ): MagicWordFactory {
820 $services->getContentLanguage(),
821 $services->getHookContainer()
822 );
823 },
824
825 'MainConfig' => static function ( MediaWikiServices $services ): Config {
826 // Use the 'main' config from the ConfigFactory service.
827 return $services->getConfigFactory()->makeConfig( 'main' );
828 },
829
830 'MainObjectStash' => static function ( MediaWikiServices $services ): BagOStuff {
831 $mainConfig = $services->getMainConfig();
832
833 $id = $mainConfig->get( 'MainStash' );
834 if ( !isset( $mainConfig->get( 'ObjectCaches' )[$id] ) ) {
835 throw new UnexpectedValueException(
836 "Cache type \"$id\" is not present in \$wgObjectCaches." );
837 }
838
839 $params = $mainConfig->get( 'ObjectCaches' )[$id];
840 $params['stats'] = $services->getStatsdDataFactory();
841
842 $store = ObjectCache::newFromParams( $params, $mainConfig );
843 $store->getLogger()->debug( 'MainObjectStash using store {class}', [
844 'class' => get_class( $store )
845 ] );
846
847 return $store;
848 },
849
850 'MainWANObjectCache' => static function ( MediaWikiServices $services ): WANObjectCache {
851 $mainConfig = $services->getMainConfig();
852
853 $wanId = $mainConfig->get( 'MainWANCache' );
854 $wanParams = $mainConfig->get( 'WANObjectCaches' )[$wanId] ?? null;
855 if ( !$wanParams ) {
856 throw new UnexpectedValueException(
857 "wgWANObjectCaches must have \"$wanId\" set (via wgMainWANCache)"
858 );
859 }
860
861 $cacheId = $wanParams['cacheId'];
862 $wanClass = $wanParams['class'];
863 unset( $wanParams['cacheId'] );
864 unset( $wanParams['class'] );
865
866 $storeParams = $mainConfig->get( 'ObjectCaches' )[$cacheId] ?? null;
867 if ( !$storeParams ) {
868 throw new UnexpectedValueException(
869 "wgObjectCaches must have \"$cacheId\" set (via wgWANObjectCaches)"
870 );
871 }
872 $storeParams['stats'] = $services->getStatsdDataFactory();
873 $store = ObjectCache::newFromParams( $storeParams, $mainConfig );
874 $logger = $store->getLogger();
875 $logger->debug( 'MainWANObjectCache using store {class}', [
876 'class' => get_class( $store )
877 ] );
878
879 $wanParams['cache'] = $store;
880 $wanParams['logger'] = $logger;
881 $wanParams['secret'] = $wanParams['secret'] ?? $mainConfig->get( 'SecretKey' );
882 if ( !$mainConfig->get( 'CommandLineMode' ) ) {
883 // Send the statsd data post-send on HTTP requests; avoid in CLI mode (T181385)
884 $wanParams['stats'] = $services->getStatsdDataFactory();
885 // Let pre-emptive refreshes happen post-send on HTTP requests
886 $wanParams['asyncHandler'] = [ DeferredUpdates::class, 'addCallableUpdate' ];
887 }
888
889 $instance = new $wanClass( $wanParams );
890
891 '@phan-var WANObjectCache $instance';
892 return $instance;
893 },
894
895 'MediaHandlerFactory' => static function ( MediaWikiServices $services ): MediaHandlerFactory {
897 LoggerFactory::getInstance( 'MediaHandlerFactory' ),
898 $services->getMainConfig()->get( 'MediaHandlers' )
899 );
900 },
901
902 'MergeHistoryFactory' => static function ( MediaWikiServices $services ): MergeHistoryFactory {
903 return $services->getService( '_PageCommandFactory' );
904 },
905
906 'MessageCache' => static function ( MediaWikiServices $services ): MessageCache {
907 $mainConfig = $services->getMainConfig();
908 $clusterCache = ObjectCache::getInstance( $mainConfig->get( 'MessageCacheType' ) );
909 $srvCache = $mainConfig->get( 'UseLocalMessageCache' )
910 ? $services->getLocalServerObjectCache()
911 : new EmptyBagOStuff();
912
913 $logger = LoggerFactory::getInstance( 'MessageCache' );
914 $logger->debug( 'MessageCache using store {class}', [
915 'class' => get_class( $clusterCache )
916 ] );
917
918 return new MessageCache(
919 $services->getMainWANObjectCache(),
920 $clusterCache,
921 $srvCache,
922 $services->getContentLanguage(),
923 $services->getLanguageConverterFactory()->getLanguageConverter(),
924 $logger,
925 [ 'useDB' => $mainConfig->get( 'UseDatabaseMessages' ) ],
926 $services->getLanguageFactory(),
927 $services->getLocalisationCache(),
928 $services->getLanguageNameUtils(),
929 $services->getLanguageFallback(),
930 $services->getHookContainer()
931 );
932 },
933
934 'MessageFormatterFactory' => static function ( MediaWikiServices $services ): IMessageFormatterFactory {
936 },
937
938 'MimeAnalyzer' => static function ( MediaWikiServices $services ): MimeAnalyzer {
939 $logger = LoggerFactory::getInstance( 'Mime' );
940 $mainConfig = $services->getMainConfig();
941 $hookRunner = new HookRunner( $services->getHookContainer() );
942 $params = [
943 'typeFile' => $mainConfig->get( 'MimeTypeFile' ),
944 'infoFile' => $mainConfig->get( 'MimeInfoFile' ),
945 'xmlTypes' => $mainConfig->get( 'XMLMimeTypes' ),
946 'guessCallback' =>
947 static function ( $mimeAnalyzer, &$head, &$tail, $file, &$mime )
948 use ( $logger, $hookRunner ) {
949 // Also test DjVu
950 $deja = new DjVuImage( $file );
951 if ( $deja->isValid() ) {
952 $logger->info( "Detected $file as image/vnd.djvu\n" );
953 $mime = 'image/vnd.djvu';
954
955 return;
956 }
957 // Some strings by reference for performance - assuming well-behaved hooks
958 $hookRunner->onMimeMagicGuessFromContent(
959 $mimeAnalyzer, $head, $tail, $file, $mime );
960 },
961 'extCallback' => static function ( $mimeAnalyzer, $ext, &$mime ) use ( $hookRunner ) {
962 // Media handling extensions can improve the MIME detected
963 $hookRunner->onMimeMagicImproveFromExtension( $mimeAnalyzer, $ext, $mime );
964 },
965 'initCallback' => static function ( $mimeAnalyzer ) use ( $hookRunner ) {
966 // Allow media handling extensions adding MIME-types and MIME-info
967 $hookRunner->onMimeMagicInit( $mimeAnalyzer );
968 },
969 'logger' => $logger
970 ];
971
972 if ( $params['infoFile'] === 'includes/mime.info' ) {
973 $params['infoFile'] = MimeAnalyzer::USE_INTERNAL;
974 }
975
976 if ( $params['typeFile'] === 'includes/mime.types' ) {
977 $params['typeFile'] = MimeAnalyzer::USE_INTERNAL;
978 }
979
980 $detectorCmd = $mainConfig->get( 'MimeDetectorCommand' );
981 if ( $detectorCmd ) {
982 $factory = $services->getShellCommandFactory();
983 $params['detectCallback'] = static function ( $file ) use ( $detectorCmd, $factory ) {
984 $result = $factory->create()
985 // $wgMimeDetectorCommand can contain commands with parameters
986 ->unsafeParams( $detectorCmd )
987 ->params( $file )
988 ->execute();
989 return $result->getStdout();
990 };
991 }
992
993 return new MimeAnalyzer( $params );
994 },
995
996 'MovePageFactory' => static function ( MediaWikiServices $services ): MovePageFactory {
997 return $services->getService( '_PageCommandFactory' );
998 },
999
1000 'NamespaceInfo' => static function ( MediaWikiServices $services ): NamespaceInfo {
1002 new ServiceOptions( NamespaceInfo::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1003 $services->getHookContainer()
1004 );
1005 },
1006
1007 'NameTableStoreFactory' => static function ( MediaWikiServices $services ): NameTableStoreFactory {
1009 $services->getDBLoadBalancerFactory(),
1010 $services->getMainWANObjectCache(),
1011 LoggerFactory::getInstance( 'NameTableSqlStore' )
1012 );
1013 },
1014
1015 'ObjectFactory' => static function ( MediaWikiServices $services ): ObjectFactory {
1016 return new ObjectFactory( $services );
1017 },
1018
1019 'OldRevisionImporter' => static function ( MediaWikiServices $services ): OldRevisionImporter {
1021 true,
1022 LoggerFactory::getInstance( 'OldRevisionImporter' ),
1023 $services->getDBLoadBalancer(),
1024 $services->getRevisionStore(),
1025 $services->getSlotRoleRegistry(),
1026 $services->getWikiPageFactory()
1027 );
1028 },
1029
1030 'PageEditStash' => static function ( MediaWikiServices $services ): PageEditStash {
1031 $config = $services->getMainConfig();
1032
1033 return new PageEditStash(
1034 ObjectCache::getLocalClusterInstance(),
1035 $services->getDBLoadBalancer(),
1036 LoggerFactory::getInstance( 'StashEdit' ),
1037 $services->getStatsdDataFactory(),
1038 $services->getUserEditTracker(),
1039 $services->getUserFactory(),
1040 $services->getHookContainer(),
1041 defined( 'MEDIAWIKI_JOB_RUNNER' ) || $config->get( 'CommandLineMode' )
1042 ? PageEditStash::INITIATOR_JOB_OR_CLI
1043 : PageEditStash::INITIATOR_USER
1044 );
1045 },
1046
1047 'PageProps' => static function ( MediaWikiServices $services ): PageProps {
1048 return new PageProps(
1049 $services->getLinkBatchFactory(),
1050 $services->getDBLoadBalancer()
1051 );
1052 },
1053
1054 'PageStore' => static function ( MediaWikiServices $services ): PageStore {
1055 return $services->getPageStoreFactory()->getPageStore();
1056 },
1057
1058 'PageStoreFactory' => static function ( MediaWikiServices $services ): PageStoreFactory {
1059 $options = new ServiceOptions(
1060 PageStoreFactory::CONSTRUCTOR_OPTIONS,
1061 $services->getMainConfig()
1062 );
1063
1064 return new PageStoreFactory(
1065 $options,
1066 $services->getDBLoadBalancerFactory(),
1067 $services->getNamespaceInfo(),
1068 $services->getTitleParser(),
1069 $services->getLinkCache(),
1070 $services->getStatsdDataFactory()
1071 );
1072 },
1073
1074 'PageUpdaterFactory' => static function (
1075 MediaWikiServices $services
1077 $editResultCache = new EditResultCache(
1078 $services->getMainObjectStash(),
1079 $services->getDBLoadBalancer(),
1080 new ServiceOptions(
1081 EditResultCache::CONSTRUCTOR_OPTIONS,
1082 $services->getMainConfig()
1083 )
1084 );
1085
1086 return new PageUpdaterFactory(
1087 $services->getRevisionStore(),
1088 $services->getRevisionRenderer(),
1089 $services->getSlotRoleRegistry(),
1090 $services->getParserCache(),
1091 $services->getJobQueueGroup(),
1092 $services->getMessageCache(),
1093 $services->getContentLanguage(),
1094 $services->getDBLoadBalancerFactory(),
1095 $services->getContentHandlerFactory(),
1096 $services->getHookContainer(),
1097 $editResultCache,
1098 $services->getUserNameUtils(),
1099 LoggerFactory::getInstance( 'SavePage' ),
1100 new ServiceOptions(
1101 PageUpdaterFactory::CONSTRUCTOR_OPTIONS,
1102 $services->getMainConfig()
1103 ),
1104 $services->getUserEditTracker(),
1105 $services->getUserGroupManager(),
1106 $services->getTitleFormatter(),
1107 $services->getContentTransformer(),
1108 $services->getPageEditStash(),
1109 $services->getTalkPageNotificationManager(),
1110 $services->getMainWANObjectCache(),
1111 $services->getPermissionManager(),
1113 );
1114 },
1115
1116 'Parser' => static function ( MediaWikiServices $services ): Parser {
1117 return $services->getParserFactory()->create();
1118 },
1119
1120 'ParserCache' => static function ( MediaWikiServices $services ): ParserCache {
1121 return $services->getParserCacheFactory()
1122 ->getParserCache( ParserCacheFactory::DEFAULT_NAME );
1123 },
1124
1125 'ParserCacheFactory' => static function ( MediaWikiServices $services ): ParserCacheFactory {
1126 $config = $services->getMainConfig();
1127 $cache = ObjectCache::getInstance( $config->get( 'ParserCacheType' ) );
1128 $wanCache = $services->getMainWANObjectCache();
1129
1130 $options = new ServiceOptions( ParserCacheFactory::CONSTRUCTOR_OPTIONS, $config );
1131
1132 return new ParserCacheFactory(
1133 $cache,
1134 $wanCache,
1135 $services->getHookContainer(),
1136 $services->getJsonCodec(),
1137 $services->getStatsdDataFactory(),
1138 LoggerFactory::getInstance( 'ParserCache' ),
1139 $options,
1140 $services->getTitleFactory(),
1141 $services->getWikiPageFactory()
1142 );
1143 },
1144
1145 'ParserFactory' => static function ( MediaWikiServices $services ): ParserFactory {
1146 $options = new ServiceOptions( Parser::CONSTRUCTOR_OPTIONS,
1147 $services->getMainConfig()
1148 );
1149
1150 return new ParserFactory(
1151 $options,
1152 $services->getMagicWordFactory(),
1153 $services->getContentLanguage(),
1155 $services->getSpecialPageFactory(),
1156 $services->getLinkRendererFactory(),
1157 $services->getNamespaceInfo(),
1158 LoggerFactory::getInstance( 'Parser' ),
1159 $services->getBadFileLookup(),
1160 $services->getLanguageConverterFactory(),
1161 $services->getHookContainer(),
1162 $services->getTidy(),
1163 $services->getMainWANObjectCache(),
1164 $services->getUserOptionsLookup(),
1165 $services->getUserFactory(),
1166 $services->getTitleFormatter(),
1167 $services->getHttpRequestFactory()
1168 );
1169 },
1170
1171 'ParserOutputAccess' => static function ( MediaWikiServices $services ): ParserOutputAccess {
1173 $services->getParserCache(),
1174 $services->getParserCacheFactory()->getRevisionOutputCache( 'rcache' ),
1175 $services->getRevisionLookup(),
1176 $services->getRevisionRenderer(),
1177 $services->getStatsdDataFactory(),
1178 $services->getDBLoadBalancerFactory(),
1179 LoggerFactory::getProvider(),
1180 $services->getWikiPageFactory(),
1181 $services->getTitleFormatter()
1182 );
1183 },
1184
1185 'PasswordFactory' => static function ( MediaWikiServices $services ): PasswordFactory {
1186 $config = $services->getMainConfig();
1187 return new PasswordFactory(
1188 $config->get( 'PasswordConfig' ),
1189 $config->get( 'PasswordDefault' )
1190 );
1191 },
1192
1193 'PasswordReset' => static function ( MediaWikiServices $services ): PasswordReset {
1194 $options = new ServiceOptions( PasswordReset::CONSTRUCTOR_OPTIONS, $services->getMainConfig() );
1195 return new PasswordReset(
1196 $options,
1197 LoggerFactory::getInstance( 'authentication' ),
1198 $services->getAuthManager(),
1199 $services->getHookContainer(),
1200 $services->getDBLoadBalancer(),
1201 $services->getUserFactory(),
1202 $services->getUserNameUtils(),
1203 $services->getUserOptionsLookup()
1204 );
1205 },
1206
1207 'PerDbNameStatsdDataFactory' =>
1208 static function ( MediaWikiServices $services ): StatsdDataFactoryInterface {
1209 $config = $services->getMainConfig();
1210 $wiki = $config->get( 'DBname' );
1212 $services->getStatsdDataFactory(),
1213 $wiki
1214 );
1215 },
1216
1217 'PermissionManager' => static function ( MediaWikiServices $services ): PermissionManager {
1219 new ServiceOptions(
1220 PermissionManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1221 ),
1222 $services->getSpecialPageFactory(),
1223 $services->getRevisionLookup(),
1224 $services->getNamespaceInfo(),
1225 $services->getGroupPermissionsLookup(),
1226 $services->getUserGroupManager(),
1227 $services->getBlockErrorFormatter(),
1228 $services->getHookContainer(),
1229 $services->getUserCache()
1230 );
1231 },
1232
1233 'PreferencesFactory' => static function ( MediaWikiServices $services ): PreferencesFactory {
1234 $factory = new DefaultPreferencesFactory(
1235 new ServiceOptions(
1236 DefaultPreferencesFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1237 $services->getContentLanguage(),
1238 $services->getAuthManager(),
1239 $services->getLinkRendererFactory()->create(),
1240 $services->getNamespaceInfo(),
1241 $services->getPermissionManager(),
1242 $services->getLanguageConverterFactory()->getLanguageConverter(),
1243 $services->getLanguageNameUtils(),
1244 $services->getHookContainer(),
1245 $services->getUserOptionsManager(),
1246 $services->getLanguageConverterFactory(),
1247 $services->getParser(),
1248 $services->getSkinFactory(),
1249 $services->getUserGroupManager()
1250 );
1251 $factory->setLogger( LoggerFactory::getInstance( 'preferences' ) );
1252
1253 return $factory;
1254 },
1255
1256 'ProxyLookup' => static function ( MediaWikiServices $services ): ProxyLookup {
1257 $mainConfig = $services->getMainConfig();
1258 return new ProxyLookup(
1259 $mainConfig->get( 'CdnServers' ),
1260 $mainConfig->get( 'CdnServersNoPurge' ),
1261 $services->getHookContainer()
1262 );
1263 },
1264
1265 'ReadOnlyMode' => static function ( MediaWikiServices $services ): ReadOnlyMode {
1266 return new ReadOnlyMode(
1267 $services->getConfiguredReadOnlyMode(),
1268 $services->getDBLoadBalancer()
1269 );
1270 },
1271
1272 'RepoGroup' => static function ( MediaWikiServices $services ): RepoGroup {
1273 $config = $services->getMainConfig();
1274 return new RepoGroup(
1275 $config->get( 'LocalFileRepo' ),
1276 $config->get( 'ForeignFileRepos' ),
1277 $services->getMainWANObjectCache(),
1278 $services->getMimeAnalyzer()
1279 );
1280 },
1281
1282 'ResourceLoader' => static function ( MediaWikiServices $services ): ResourceLoader {
1283 // @todo This should not take a Config object, but it's not so easy to remove because it
1284 // exposes it in a getter, which is actually used.
1285 global $IP;
1286 $config = $services->getMainConfig();
1287
1288 $rl = new ResourceLoader(
1289 $config,
1290 LoggerFactory::getInstance( 'resourceloader' ),
1291 $config->get( 'ResourceLoaderUseObjectCacheForDeps' )
1292 ? new KeyValueDependencyStore( $services->getMainObjectStash() )
1293 : new SqlModuleDependencyStore( $services->getDBLoadBalancer() )
1294 );
1295
1296 $extRegistry = ExtensionRegistry::getInstance();
1297 // Attribute has precedence over config
1298 $modules = $extRegistry->getAttribute( 'ResourceModules' )
1299 + $config->get( 'ResourceModules' );
1300 $moduleSkinStyles = $extRegistry->getAttribute( 'ResourceModuleSkinStyles' )
1301 + $config->get( 'ResourceModuleSkinStyles' );
1302
1303 $rl->setModuleSkinStyles( $moduleSkinStyles );
1304 $rl->addSource( $config->get( 'ResourceLoaderSources' ) );
1305
1306 // Core modules, then extension/skin modules
1307 $rl->register( include "$IP/resources/Resources.php" );
1308 $rl->register( $modules );
1309 $hookRunner = new \MediaWiki\ResourceLoader\HookRunner( $services->getHookContainer() );
1310 $hookRunner->onResourceLoaderRegisterModules( $rl );
1311
1312 $msgPosterAttrib = $extRegistry->getAttribute( 'MessagePosterModule' );
1313 $rl->register( 'mediawiki.messagePoster', [
1314 'localBasePath' => $IP,
1315 'debugRaw' => false,
1316 'scripts' => array_merge(
1317 [
1318 "resources/src/mediawiki.messagePoster/factory.js",
1319 "resources/src/mediawiki.messagePoster/MessagePoster.js",
1320 "resources/src/mediawiki.messagePoster/WikitextMessagePoster.js",
1321 ],
1322 $msgPosterAttrib['scripts'] ?? []
1323 ),
1324 'dependencies' => array_merge(
1325 [
1326 'oojs',
1327 'mediawiki.api',
1328 'mediawiki.ForeignApi',
1329 ],
1330 $msgPosterAttrib['dependencies'] ?? []
1331 ),
1332 'targets' => [ 'desktop', 'mobile' ],
1333 ] );
1334
1335 if ( $config->get( 'EnableJavaScriptTest' ) === true ) {
1336 $rl->registerTestModules();
1337 }
1338
1339 return $rl;
1340 },
1341
1342 'RestrictionStore' => static function ( MediaWikiServices $services ): RestrictionStore {
1344 new ServiceOptions(
1345 RestrictionStore::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1346 ),
1347 $services->getMainWANObjectCache(),
1348 $services->getDBLoadBalancer(),
1349 $services->getLinkCache(),
1350 $services->getCommentStore(),
1351 $services->getHookContainer(),
1352 $services->getPageStore()
1353 );
1354 },
1355
1356 'RevertedTagUpdateManager' => static function ( MediaWikiServices $services ): RevertedTagUpdateManager {
1357 $editResultCache = new EditResultCache(
1358 $services->getMainObjectStash(),
1359 $services->getDBLoadBalancer(),
1360 new ServiceOptions(
1361 EditResultCache::CONSTRUCTOR_OPTIONS,
1362 $services->getMainConfig()
1363 )
1364 );
1365
1366 return new RevertedTagUpdateManager(
1367 $editResultCache,
1368 $services->getJobQueueGroup()
1369 );
1370 },
1371
1372 'RevisionFactory' => static function ( MediaWikiServices $services ): RevisionFactory {
1373 return $services->getRevisionStore();
1374 },
1375
1376 'RevisionLookup' => static function ( MediaWikiServices $services ): RevisionLookup {
1377 return $services->getRevisionStore();
1378 },
1379
1380 'RevisionRenderer' => static function ( MediaWikiServices $services ): RevisionRenderer {
1381 $renderer = new RevisionRenderer(
1382 $services->getDBLoadBalancer(),
1383 $services->getSlotRoleRegistry()
1384 );
1385
1386 $renderer->setLogger( LoggerFactory::getInstance( 'SaveParse' ) );
1387 return $renderer;
1388 },
1389
1390 'RevisionStore' => static function ( MediaWikiServices $services ): RevisionStore {
1391 return $services->getRevisionStoreFactory()->getRevisionStore();
1392 },
1393
1394 'RevisionStoreFactory' => static function ( MediaWikiServices $services ): RevisionStoreFactory {
1395 $config = $services->getMainConfig();
1396
1397 if ( $config->has( 'MultiContentRevisionSchemaMigrationStage' ) ) {
1398 if ( $config->get( 'MultiContentRevisionSchemaMigrationStage' ) !== SCHEMA_COMPAT_NEW ) {
1399 throw new UnexpectedValueException(
1400 'The MultiContentRevisionSchemaMigrationStage setting is no longer supported!'
1401 );
1402 }
1403 }
1404
1405 $store = new RevisionStoreFactory(
1406 $services->getDBLoadBalancerFactory(),
1407 $services->getBlobStoreFactory(),
1408 $services->getNameTableStoreFactory(),
1409 $services->getSlotRoleRegistry(),
1410 $services->getMainWANObjectCache(),
1411 $services->getCommentStore(),
1412 $services->getActorMigration(),
1413 $services->getActorStoreFactory(),
1414 LoggerFactory::getInstance( 'RevisionStore' ),
1415 $services->getContentHandlerFactory(),
1416 $services->getPageStoreFactory(),
1417 $services->getTitleFactory(),
1418 $services->getHookContainer()
1419 );
1420
1421 return $store;
1422 },
1423
1424 'RollbackPageFactory' => static function ( MediaWikiServices $services ): RollbackPageFactory {
1425 return $services->get( '_PageCommandFactory' );
1426 },
1427
1428 'SearchEngineConfig' => static function ( MediaWikiServices $services ): SearchEngineConfig {
1429 // @todo This should not take a Config object, but it's not so easy to remove because it
1430 // exposes it in a getter, which is actually used.
1432 $services->getMainConfig(),
1433 $services->getContentLanguage(),
1434 $services->getHookContainer(),
1435 ExtensionRegistry::getInstance()->getAttribute( 'SearchMappings' )
1436 );
1437 },
1438
1439 'SearchEngineFactory' => static function ( MediaWikiServices $services ): SearchEngineFactory {
1441 $services->getSearchEngineConfig(),
1442 $services->getHookContainer(),
1443 $services->getDBLoadBalancer()
1444 );
1445 },
1446
1447 'ShellboxClientFactory' => static function ( MediaWikiServices $services ): ShellboxClientFactory {
1448 $urls = $services->getMainConfig()->get( 'ShellboxUrls' );
1449 // TODO: Remove this logic and $wgShellboxUrl configuration in 1.38
1450 $url = $services->getMainConfig()->get( 'ShellboxUrl' );
1451 if ( $url !== null ) {
1452 $urls['default'] = $url;
1453 }
1454 return new ShellboxClientFactory(
1455 $services->getHttpRequestFactory(),
1456 $urls,
1457 $services->getMainConfig()->get( 'ShellboxSecretKey' )
1458 );
1459 },
1460
1461 'ShellCommandFactory' => static function ( MediaWikiServices $services ): CommandFactory {
1462 $config = $services->getMainConfig();
1463
1464 $limits = [
1465 'time' => $config->get( 'MaxShellTime' ),
1466 'walltime' => $config->get( 'MaxShellWallClockTime' ),
1467 'memory' => $config->get( 'MaxShellMemory' ),
1468 'filesize' => $config->get( 'MaxShellFileSize' ),
1469 ];
1470 $cgroup = $config->get( 'ShellCgroup' );
1471 $restrictionMethod = $config->get( 'ShellRestrictionMethod' );
1472
1473 $factory = new CommandFactory( $services->getShellboxClientFactory(),
1474 $limits, $cgroup, $restrictionMethod );
1475 $factory->setLogger( LoggerFactory::getInstance( 'exec' ) );
1476 $factory->logStderr();
1477
1478 return $factory;
1479 },
1480
1481 'SiteLookup' => static function ( MediaWikiServices $services ): SiteLookup {
1482 // Use SiteStore as the SiteLookup as well. This was originally separated
1483 // to allow for a cacheable read-only interface, but this was never used.
1484 // SiteStore has caching (see below).
1485 return $services->getSiteStore();
1486 },
1487
1488 'SiteStore' => static function ( MediaWikiServices $services ): SiteStore {
1489 $rawSiteStore = new DBSiteStore( $services->getDBLoadBalancer() );
1490
1491 $cache = $services->getLocalServerObjectCache();
1492 if ( $cache instanceof EmptyBagOStuff ) {
1494 }
1495
1496 return new CachingSiteStore( $rawSiteStore, $cache );
1497 },
1498
1500 'SkinFactory' => static function ( MediaWikiServices $services ): SkinFactory {
1501 $factory = new SkinFactory(
1502 $services->getObjectFactory(),
1503 (array)$services->getMainConfig()->get( 'SkipSkins' )
1504 );
1505
1506 $names = $services->getMainConfig()->get( 'ValidSkinNames' );
1507
1508 foreach ( $names as $name => $skin ) {
1509 if ( is_array( $skin ) ) {
1510 $spec = $skin;
1511 $displayName = $skin['displayname'] ?? $name;
1512 } else {
1513 $displayName = $skin;
1514 $spec = [
1515 'name' => $name,
1516 'class' => "Skin$skin"
1517 ];
1518 }
1519 $factory->register( $name, $displayName, $spec );
1520 }
1521
1522 // Register a hidden "fallback" skin
1523 $factory->register( 'fallback', 'Fallback', [
1524 'class' => SkinFallback::class,
1525 'args' => [
1526 [
1527 'name' => 'fallback',
1528 'styles' => [ 'mediawiki.skinning.interface' ],
1529 'templateDirectory' => __DIR__ . '/skins/templates/fallback',
1530 ]
1531 ]
1532 ] );
1533 // Register a hidden skin for api output
1534 $factory->register( 'apioutput', 'ApiOutput', [
1535 'class' => SkinApi::class,
1536 'args' => [
1537 [
1538 'name' => 'apioutput',
1539 'styles' => [ 'mediawiki.skinning.interface' ],
1540 'templateDirectory' => __DIR__ . '/skins/templates/apioutput',
1541 ]
1542 ]
1543 ] );
1544
1545 return $factory;
1546 },
1547
1548 'SlotRoleRegistry' => static function ( MediaWikiServices $services ): SlotRoleRegistry {
1549 $registry = new SlotRoleRegistry(
1550 $services->getSlotRoleStore()
1551 );
1552
1553 $config = $services->getMainConfig();
1554 $contentHandlerFactory = $services->getContentHandlerFactory();
1555 $hookContainer = $services->getHookContainer();
1556 $titleFactory = $services->getTitleFactory();
1557 $registry->defineRole(
1558 'main',
1559 static function () use ( $config, $contentHandlerFactory, $hookContainer, $titleFactory ) {
1560 return new MainSlotRoleHandler(
1561 $config->get( 'NamespaceContentModels' ),
1562 $contentHandlerFactory,
1563 $hookContainer,
1564 $titleFactory
1565 );
1566 }
1567 );
1568
1569 return $registry;
1570 },
1571
1572 'SlotRoleStore' => static function ( MediaWikiServices $services ): NameTableStore {
1573 return $services->getNameTableStoreFactory()->getSlotRoles();
1574 },
1575
1576 'SpamChecker' => static function ( MediaWikiServices $services ): SpamChecker {
1577 return new SpamChecker(
1578 (array)$services->getMainConfig()->get( 'SpamRegex' ),
1579 (array)$services->getMainConfig()->get( 'SummarySpamRegex' )
1580 );
1581 },
1582
1583 'SpecialPageFactory' => static function ( MediaWikiServices $services ): SpecialPageFactory {
1585 new ServiceOptions(
1586 SpecialPageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1587 $services->getContentLanguage(),
1588 $services->getObjectFactory(),
1589 $services->getTitleFactory(),
1590 $services->getHookContainer()
1591 );
1592 },
1593
1594 'StatsdDataFactory' => static function ( MediaWikiServices $services ): IBufferingStatsdDataFactory {
1596 rtrim( $services->getMainConfig()->get( 'StatsdMetricPrefix' ), '.' )
1597 );
1598 },
1599
1600 'TalkPageNotificationManager' => static function (
1601 MediaWikiServices $services
1604 new ServiceOptions(
1605 TalkPageNotificationManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1606 ),
1607 $services->getDBLoadBalancer(),
1608 $services->getReadOnlyMode(),
1609 $services->getRevisionLookup()
1610 );
1611 },
1612
1613 'TempFSFileFactory' => static function ( MediaWikiServices $services ): TempFSFileFactory {
1614 return new TempFSFileFactory( $services->getMainConfig()->get( 'TmpDirectory' ) );
1615 },
1616
1617 'Tidy' => static function ( MediaWikiServices $services ): TidyDriverBase {
1618 return new RemexDriver(
1619 new ServiceOptions(
1620 RemexDriver::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1621 )
1622 );
1623 },
1624
1625 'TitleFactory' => static function ( MediaWikiServices $services ): TitleFactory {
1626 return new TitleFactory();
1627 },
1628
1629 'TitleFormatter' => static function ( MediaWikiServices $services ): TitleFormatter {
1630 return $services->getService( '_MediaWikiTitleCodec' );
1631 },
1632
1633 'TitleParser' => static function ( MediaWikiServices $services ): TitleParser {
1634 return $services->getService( '_MediaWikiTitleCodec' );
1635 },
1636
1637 'UnblockUserFactory' => static function ( MediaWikiServices $services ): UnblockUserFactory {
1638 return $services->getService( '_UserBlockCommandFactory' );
1639 },
1640
1641 'UploadRevisionImporter' => static function ( MediaWikiServices $services ): UploadRevisionImporter {
1643 $services->getMainConfig()->get( 'EnableUploads' ),
1644 LoggerFactory::getInstance( 'UploadRevisionImporter' )
1645 );
1646 },
1647
1648 'UserCache' => static function ( MediaWikiServices $services ): UserCache {
1649 return new UserCache(
1650 LoggerFactory::getInstance( 'UserCache' ),
1651 $services->getDBLoadBalancer(),
1652 $services->getLinkBatchFactory()
1653 );
1654 },
1655
1656 'UserEditTracker' => static function ( MediaWikiServices $services ): UserEditTracker {
1658 $services->getActorMigration(),
1659 $services->getDBLoadBalancer(),
1660 $services->getJobQueueGroup()
1661 );
1662 },
1663
1664 'UserFactory' => static function ( MediaWikiServices $services ): UserFactory {
1665 return new UserFactory(
1666 $services->getDBLoadBalancer(),
1667 $services->getUserNameUtils()
1668 );
1669 },
1670
1671 'UserGroupManager' => static function ( MediaWikiServices $services ): UserGroupManager {
1672 return $services->getUserGroupManagerFactory()->getUserGroupManager();
1673 },
1674
1675 'UserGroupManagerFactory' => static function ( MediaWikiServices $services ): UserGroupManagerFactory {
1677 new ServiceOptions(
1678 UserGroupManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1679 ),
1680 $services->getConfiguredReadOnlyMode(),
1681 $services->getDBLoadBalancerFactory(),
1682 $services->getHookContainer(),
1683 $services->getUserEditTracker(),
1684 $services->getGroupPermissionsLookup(),
1685 $services->getJobQueueGroupFactory(),
1686 LoggerFactory::getInstance( 'UserGroupManager' ),
1687 [ static function ( UserIdentity $user ) use ( $services ) {
1688 $services->getPermissionManager()->invalidateUsersRightsCache( $user );
1689 $services->getUserFactory()->newFromUserIdentity( $user )->invalidateCache();
1690 } ]
1691 );
1692 },
1693
1694 'UserIdentityLookup' => static function ( MediaWikiServices $services ): UserIdentityLookup {
1695 return $services->getActorStoreFactory()->getUserIdentityLookup();
1696 },
1697
1698 'UserNamePrefixSearch' => static function ( MediaWikiServices $services ): UserNamePrefixSearch {
1700 $services->getDBLoadBalancer(),
1701 $services->getUserFactory(),
1702 $services->getUserNameUtils()
1703 );
1704 },
1705
1706 'UserNameUtils' => static function ( MediaWikiServices $services ): UserNameUtils {
1707 $messageFormatterFactory = new MessageFormatterFactory( Message::FORMAT_PLAIN );
1708 return new UserNameUtils(
1709 new ServiceOptions(
1710 UserNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1711 ),
1712 $services->getContentLanguage(),
1713 LoggerFactory::getInstance( 'UserNameUtils' ),
1714 $services->getTitleParser(),
1715 $messageFormatterFactory->getTextFormatter(
1716 $services->getContentLanguage()->getCode()
1717 ),
1718 $services->getHookContainer()
1719 );
1720 },
1721
1722 'UserOptionsLookup' => static function ( MediaWikiServices $services ): UserOptionsLookup {
1723 return $services->getUserOptionsManager();
1724 },
1725
1726 'UserOptionsManager' => static function ( MediaWikiServices $services ): UserOptionsManager {
1728 new ServiceOptions( UserOptionsManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1729 $services->get( '_DefaultOptionsLookup' ),
1730 $services->getLanguageConverterFactory(),
1731 $services->getDBLoadBalancer(),
1732 LoggerFactory::getInstance( 'UserOptionsManager' ),
1733 $services->getHookContainer()
1734 );
1735 },
1736
1737 'VirtualRESTServiceClient' =>
1738 static function ( MediaWikiServices $services ): VirtualRESTServiceClient {
1739 $config = $services->getMainConfig()->get( 'VirtualRestConfig' );
1740
1741 $vrsClient = new VirtualRESTServiceClient(
1742 $services->getHttpRequestFactory()->createMultiClient() );
1743 foreach ( $config['paths'] as $prefix => $serviceConfig ) {
1744 $class = $serviceConfig['class'];
1745 // Merge in the global defaults
1746 $constructArg = $serviceConfig['options'] ?? [];
1747 $constructArg += $config['global'];
1748 // Make the VRS service available at the mount point
1749 $vrsClient->mount( $prefix, [ 'class' => $class, 'config' => $constructArg ] );
1750 }
1751
1752 return $vrsClient;
1753 },
1754
1755 'WatchedItemQueryService' =>
1756 static function ( MediaWikiServices $services ): WatchedItemQueryService {
1758 $services->getDBLoadBalancer(),
1759 $services->getCommentStore(),
1760 $services->getWatchedItemStore(),
1761 $services->getHookContainer(),
1762 $services->getMainConfig()->get( 'WatchlistExpiry' ),
1763 $services->getMainConfig()->get( 'MaxExecutionTimeForExpensiveQueries' )
1764 );
1765 },
1766
1767 'WatchedItemStore' => static function ( MediaWikiServices $services ): WatchedItemStore {
1768 $store = new WatchedItemStore(
1769 new ServiceOptions( WatchedItemStore::CONSTRUCTOR_OPTIONS,
1770 $services->getMainConfig() ),
1771 $services->getDBLoadBalancerFactory(),
1772 $services->getJobQueueGroup(),
1773 $services->getMainObjectStash(),
1774 new HashBagOStuff( [ 'maxKeys' => 100 ] ),
1775 $services->getReadOnlyMode(),
1776 $services->getNamespaceInfo(),
1777 $services->getRevisionLookup(),
1778 $services->getHookContainer(),
1779 $services->getLinkBatchFactory(),
1780 $services->getUserFactory(),
1781 $services->getTitleFactory()
1782 );
1783 $store->setStatsdDataFactory( $services->getStatsdDataFactory() );
1784
1785 if ( $services->getMainConfig()->get( 'ReadOnlyWatchedItemStore' ) ) {
1786 $store = new NoWriteWatchedItemStore( $store );
1787 }
1788
1789 return $store;
1790 },
1791
1792 'WatchlistManager' => static function ( MediaWikiServices $services ): WatchlistManager {
1794 new ServiceOptions(
1795 WatchlistManager::CONSTRUCTOR_OPTIONS,
1796 $services->getMainConfig()
1797 ),
1798 $services->getHookContainer(),
1799 $services->getReadOnlyMode(),
1800 $services->getRevisionLookup(),
1801 $services->getTalkPageNotificationManager(),
1802 $services->getWatchedItemStore(),
1803 $services->getUserFactory(),
1804 $services->getNamespaceInfo(),
1805 $services->getWikiPageFactory()
1806 );
1807 },
1808
1809 'WikiImporterFactory' => static function ( MediaWikiServices $services ): WikiImporterFactory {
1811 $services->getMainConfig(),
1812 $services->getHookContainer(),
1813 $services->getContentLanguage(),
1814 $services->getNamespaceInfo(),
1815 $services->getTitleFactory(),
1816 $services->getWikiPageFactory(),
1817 $services->getWikiRevisionUploadImporter(),
1818 $services->getPermissionManager(),
1819 $services->getContentHandlerFactory(),
1820 $services->getSlotRoleRegistry()
1821 );
1822 },
1823
1824 'WikiPageFactory' => static function ( MediaWikiServices $services ): WikiPageFactory {
1826 $services->getTitleFactory(),
1827 new HookRunner( $services->getHookContainer() ),
1828 $services->getDBLoadBalancer()
1829 );
1830 },
1831
1832 'WikiRevisionOldRevisionImporterNoUpdates' =>
1833 static function ( MediaWikiServices $services ): ImportableOldRevisionImporter {
1835 false,
1836 LoggerFactory::getInstance( 'OldRevisionImporter' ),
1837 $services->getDBLoadBalancer(),
1838 $services->getRevisionStore(),
1839 $services->getSlotRoleRegistry(),
1840 $services->getWikiPageFactory()
1841 );
1842 },
1843
1844 '_DefaultOptionsLookup' => static function ( MediaWikiServices $services ): DefaultOptionsLookup {
1846 new ServiceOptions( DefaultOptionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1847 $services->getContentLanguage(),
1848 $services->getHookContainer()
1849 );
1850 },
1851
1852 '_EditConstraintFactory' => static function ( MediaWikiServices $services ): EditConstraintFactory {
1853 // This service is internal and currently only exists because a significant number
1854 // of dependencies will be needed by different constraints. It is not part of
1855 // the public interface and has no corresponding method in MediaWikiServices
1857 // Multiple
1858 new ServiceOptions(
1859 EditConstraintFactory::CONSTRUCTOR_OPTIONS,
1860 $services->getMainConfig()
1861 ),
1862 LoggerFactory::getProvider(),
1863
1864 // UserBlockConstraint
1865 $services->getPermissionManager(),
1866
1867 // EditFilterMergedContentHookConstraint
1868 $services->getHookContainer(),
1869
1870 // ReadOnlyConstraint
1871 $services->getReadOnlyMode(),
1872
1873 // SpamRegexConstraint
1874 $services->getSpamChecker()
1875 );
1876 },
1877
1878 '_MediaWikiTitleCodec' => static function ( MediaWikiServices $services ): MediaWikiTitleCodec {
1880 $services->getContentLanguage(),
1881 $services->getGenderCache(),
1882 $services->getMainConfig()->get( 'LocalInterwikis' ),
1883 $services->getInterwikiLookup(),
1884 $services->getNamespaceInfo()
1885 );
1886 },
1887
1888 '_PageCommandFactory' => static function ( MediaWikiServices $services ): PageCommandFactory {
1890 $services->getMainConfig(),
1891 $services->getDBLoadBalancerFactory(),
1892 $services->getNamespaceInfo(),
1893 $services->getWatchedItemStore(),
1894 $services->getRepoGroup(),
1895 $services->getReadOnlyMode(),
1896 $services->getContentHandlerFactory(),
1897 $services->getRevisionStore(),
1898 $services->getSpamChecker(),
1899 $services->getTitleFormatter(),
1900 $services->getHookContainer(),
1901 $services->getWikiPageFactory(),
1902 $services->getUserFactory(),
1903 $services->getActorMigration(),
1904 $services->getActorNormalization(),
1905 $services->getTitleFactory(),
1906 $services->getUserEditTracker(),
1907 $services->getCollationFactory(),
1908 $services->getJobQueueGroup(),
1909 $services->getCommentStore(),
1910 ObjectCache::getInstance( 'db-replicated' ),
1911 WikiMap::getCurrentWikiDbDomain()->getId(),
1912 WebRequest::getRequestId(),
1913 $services->getBacklinkCacheFactory()
1914 );
1915 },
1916
1917 '_SqlBlobStore' => static function ( MediaWikiServices $services ): SqlBlobStore {
1918 return $services->getBlobStoreFactory()->newSqlBlobStore();
1919 },
1920
1921 '_UserBlockCommandFactory' => static function ( MediaWikiServices $services ): UserBlockCommandFactory {
1923 new ServiceOptions( UserBlockCommandFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1924 $services->getHookContainer(),
1925 $services->getBlockPermissionCheckerFactory(),
1926 $services->getBlockUtils(),
1927 $services->getDatabaseBlockStore(),
1928 $services->getBlockRestrictionStore(),
1929 $services->getUserFactory(),
1930 $services->getUserEditTracker(),
1931 LoggerFactory::getInstance( 'BlockManager' ),
1932 $services->getTitleFactory(),
1933 $services->getBlockActionInfo()
1934 );
1935 },
1936
1938 // NOTE: When adding a service here, don't forget to add a getter function
1939 // in the MediaWikiServices class. The convenience getter should just call
1940 // $this->getService( 'FooBarService' ).
1942
1943];
const MIGRATION_NEW
Definition Defines.php:303
const SCHEMA_COMPAT_NEW
Definition Defines.php:276
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...
wfUrlProtocols( $includeProtocolRelative=true)
Returns a regular expression of url protocols.
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( 'Actions'), LoggerFactory::getInstance( 'ActionFactory'), $services->getObjectFactory(), $services->getHookContainer());}, 'ActorMigration'=> static function(MediaWikiServices $services):ActorMigration { return new ActorMigration($services->getMainConfig() ->get( 'ActorTableSchemaMigrationStage'), $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'));}, '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 new BlockRestrictionStore($services->getDBLoadBalancer());}, '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());}, 'CommentStore'=> static function(MediaWikiServices $services):CommentStore { return new CommentStore($services->getContentLanguage(), MIGRATION_NEW);}, 'ConfigFactory'=> static function(MediaWikiServices $services):ConfigFactory { $registry=$services->getBootstrapConfig() ->get( '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());}, 'ConfiguredReadOnlyMode'=> static function(MediaWikiServices $services):ConfiguredReadOnlyMode { $config=$services->getMainConfig();return new ConfiguredReadOnlyMode($config->get( 'ReadOnly'), $config->get( 'ReadOnlyFile'));}, 'ContentHandlerFactory'=> static function(MediaWikiServices $services):IContentHandlerFactory { $contentHandlerConfig=$services->getMainConfig() ->get( '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( 'LanguageCode'));}, 'ContentModelChangeFactory'=> static function(MediaWikiServices $services):ContentModelChangeFactory { return $services->getService( '_PageCommandFactory');}, 'ContentModelStore'=> static function(MediaWikiServices $services):NameTableStore { return $services->getNameTableStoreFactory() ->getContentModels();}, '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());}, 'CriticalSectionProvider'=> static function(MediaWikiServices $services):CriticalSectionProvider { $config=$services->getMainConfig();$limit=$config->get( 'CommandLineMode') ? INF :$config->get( 'CriticalSectionTimeLimit');return RequestTimeout::singleton() ->createCriticalSectionProvider( $limit);}, 'CryptHKDF'=> static function(MediaWikiServices $services):CryptHKDF { $config=$services->getMainConfig();$secret=$config->get( 'HKDFSecret') ?:$config->get( '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( '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());}, '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();$cpStashType=$mainConfig->get( 'ChronologyProtectorStash');if(is_string( $cpStashType)) { $cpStash=ObjectCache::getInstance( $cpStashType);} else { try { $cpStash=ObjectCache::getLocalClusterInstance();} catch(RecursiveServiceDependencyException $e) { $cpStash=new EmptyBagOStuff();} } LoggerFactory::getInstance( 'DBReplication') ->debug('ChronologyProtector using store {class}', [ 'class'=> get_class( $cpStash)]);try { $wanCache=$services->getMainWANObjectCache();} catch(RecursiveServiceDependencyException $e) { $wanCache=WANObjectCache::newEmpty();} $srvCache=$services->getLocalServerObjectCache();if( $srvCache instanceof EmptyBagOStuff) { $srvCache=new HashBagOStuff([ 'maxKeys'=> 100]);} $lbConf=MWLBFactory::applyDefaultConfig($mainConfig->get( 'LBFactoryConf'), new ServiceOptions(MWLBFactory::APPLY_DEFAULT_CONFIG_OPTIONS, $mainConfig), $services->getConfiguredReadOnlyMode(), $cpStash, $srvCache, $wanCache, $services->getCriticalSectionProvider());$class=MWLBFactory::getLBFactoryClass( $lbConf);$instance=new $class( $lbConf);MWLBFactory::setDomainAliases( $instance);MWLBFactory::applyGlobalState($instance, $mainConfig, $services->getStatsdDataFactory());return $instance;}, '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( '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( 'DefaultExternalStore');return new ExternalStoreFactory($config->get( '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( 'TmpDirectory'), static function( $command) { return wfShellExec( $command);});}, '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( 'CdnReboundPurgeDelay'), $config->get( 'UseFileCache'), $config->get( 'CdnMaxAge'));}, '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( 'InterwikiExpiry'), $config->get( 'InterwikiCache'), $config->get( 'InterwikiScopes'), $config->get( '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( 'UsePigLatinVariant');$isConversionDisabled=$services->getMainConfig() ->get( 'DisableLangConversion');$isTitleConversionDisabled=$services->getMainConfig() ->get( 'DisableTitleConversion');return new LanguageConverterFactory($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->getLocalisationCache(), $services->getLanguageNameUtils(), $services->getLanguageFallback(), $services->getLanguageConverterFactory(), $services->getHookContainer());}, 'LanguageFallback'=> static function(MediaWikiServices $services):LanguageFallback { return new LanguageFallback($services->getMainConfig() ->get( '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());}, '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->getNamespaceInfo(), $services->getSpecialPageFactory(), $services->getHookContainer());}, 'LocalisationCache'=> static function(MediaWikiServices $services):LocalisationCache { $conf=$services->getMainConfig() ->get( 'LocalisationCacheConf');$logger=LoggerFactory::getInstance( 'localisation');$store=LocalisationCache::getStoreFromConf($conf, $services->getMainConfig() ->get( '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( 'LockManagers'), $services->getDBLoadBalancerFactory());}, '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( 'MainStash');if(!isset( $mainConfig->get( 'ObjectCaches')[$id])) { throw new UnexpectedValueException("Cache type \"$id\" is not present in \$wgObjectCaches.");} $params=$mainConfig->get( 'ObjectCaches')[$id];$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( 'MainWANCache');$wanParams=$mainConfig->get( '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( '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( 'SecretKey');if(! $mainConfig->get( 'CommandLineMode')) { $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( '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( 'MessageCacheType'));$srvCache=$mainConfig->get( 'UseLocalMessageCache') ? $services->getLocalServerObjectCache() :new EmptyBagOStuff();$logger=LoggerFactory::getInstance( 'MessageCache');$logger->debug( 'MessageCache using store {class}', ['class'=> get_class( $clusterCache)]);return new MessageCache($services->getMainWANObjectCache(), $clusterCache, $srvCache, $services->getContentLanguage(), $services->getLanguageConverterFactory() ->getLanguageConverter(), $logger, [ 'useDB'=> $mainConfig->get( 'UseDatabaseMessages')], $services->getLanguageFactory(), $services->getLocalisationCache(), $services->getLanguageNameUtils(), $services->getLanguageFallback(), $services->getHookContainer());}, 'MessageFormatterFactory'=> static function(MediaWikiServices $services):IMessageFormatterFactory { return new MessageFormatterFactory();}, 'MimeAnalyzer'=> static function(MediaWikiServices $services):MimeAnalyzer { $logger=LoggerFactory::getInstance( 'Mime');$mainConfig=$services->getMainConfig();$hookRunner=new HookRunner( $services->getHookContainer());$params=['typeFile'=> $mainConfig->get( 'MimeTypeFile'), 'infoFile'=> $mainConfig->get( 'MimeInfoFile'), 'xmlTypes'=> $mainConfig->get( '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( '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());}, '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->getHookContainer(), defined( 'MEDIAWIKI_JOB_RUNNER')|| $config->get( 'CommandLineMode') ? 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->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(), ChangeTags::getSoftwareTags());}, 'Parser'=> static function(MediaWikiServices $services):Parser { return $services->getParserFactory() ->create();}, '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( '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(), wfUrlProtocols(), $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());}, '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());}, 'PasswordFactory'=> static function(MediaWikiServices $services):PasswordFactory { $config=$services->getMainConfig();return new PasswordFactory($config->get( 'PasswordConfig'), $config->get( '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( '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->getRevisionLookup(), $services->getNamespaceInfo(), $services->getGroupPermissionsLookup(), $services->getUserGroupManager(), $services->getBlockErrorFormatter(), $services->getHookContainer(), $services->getUserCache());}, '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());$factory->setLogger(LoggerFactory::getInstance( 'preferences'));return $factory;}, 'ProxyLookup'=> static function(MediaWikiServices $services):ProxyLookup { $mainConfig=$services->getMainConfig();return new ProxyLookup($mainConfig->get( 'CdnServers'), $mainConfig->get( 'CdnServersNoPurge'), $services->getHookContainer());}, 'ReadOnlyMode'=> static function(MediaWikiServices $services):ReadOnlyMode { return new ReadOnlyMode($services->getConfiguredReadOnlyMode(), $services->getDBLoadBalancer());}, 'RepoGroup'=> static function(MediaWikiServices $services):RepoGroup { $config=$services->getMainConfig();return new RepoGroup($config->get( 'LocalFileRepo'), $config->get( 'ForeignFileRepos'), $services->getMainWANObjectCache(), $services->getMimeAnalyzer());}, 'ResourceLoader'=> static function(MediaWikiServices $services):ResourceLoader { global $IP;$config=$services->getMainConfig();$rl=new ResourceLoader($config, LoggerFactory::getInstance( 'resourceloader'), $config->get( 'ResourceLoaderUseObjectCacheForDeps') ? new KeyValueDependencyStore( $services->getMainObjectStash()) :new SqlModuleDependencyStore( $services->getDBLoadBalancer()));$extRegistry=ExtensionRegistry::getInstance();$modules=$extRegistry->getAttribute( 'ResourceModules')+ $config->get( 'ResourceModules');$moduleSkinStyles=$extRegistry->getAttribute( 'ResourceModuleSkinStyles')+ $config->get( 'ResourceModuleSkinStyles');$rl->setModuleSkinStyles( $moduleSkinStyles);$rl->addSource( $config->get( 'ResourceLoaderSources'));$rl->register(include "$IP/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'=> $IP, '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( '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->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());$renderer->setLogger(LoggerFactory::getInstance( 'SaveParse'));return $renderer;}, 'RevisionStore'=> static function(MediaWikiServices $services):RevisionStore { return $services->getRevisionStoreFactory() ->getRevisionStore();}, 'RevisionStoreFactory'=> static function(MediaWikiServices $services):RevisionStoreFactory { $config=$services->getMainConfig();if( $config->has( 'MultiContentRevisionSchemaMigrationStage')) { if( $config->get( 'MultiContentRevisionSchemaMigrationStage') !==SCHEMA_COMPAT_NEW) { throw new UnexpectedValueException('The MultiContentRevisionSchemaMigrationStage setting is no longer supported!');} } $store=new RevisionStoreFactory($services->getDBLoadBalancerFactory(), $services->getBlobStoreFactory(), $services->getNameTableStoreFactory(), $services->getSlotRoleRegistry(), $services->getMainWANObjectCache(), $services->getCommentStore(), $services->getActorMigration(), $services->getActorStoreFactory(), LoggerFactory::getInstance( 'RevisionStore'), $services->getContentHandlerFactory(), $services->getPageStoreFactory(), $services->getTitleFactory(), $services->getHookContainer());return $store;}, 'RollbackPageFactory'=> static function(MediaWikiServices $services):RollbackPageFactory { return $services->get( '_PageCommandFactory');}, 'SearchEngineConfig'=> static function(MediaWikiServices $services):SearchEngineConfig { return new SearchEngineConfig($services->getMainConfig(), $services->getContentLanguage(), $services->getHookContainer(), ExtensionRegistry::getInstance() ->getAttribute( 'SearchMappings'));}, '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( 'ShellboxUrls');$url=$services->getMainConfig() ->get( 'ShellboxUrl');if( $url !==null) { $urls['default']=$url;} return new ShellboxClientFactory($services->getHttpRequestFactory(), $urls, $services->getMainConfig() ->get( 'ShellboxSecretKey'));}, 'ShellCommandFactory'=> static function(MediaWikiServices $services):CommandFactory { $config=$services->getMainConfig();$limits=['time'=> $config->get( 'MaxShellTime'), 'walltime'=> $config->get( 'MaxShellWallClockTime'), 'memory'=> $config->get( 'MaxShellMemory'), 'filesize'=> $config->get( 'MaxShellFileSize'),];$cgroup=$config->get( 'ShellCgroup');$restrictionMethod=$config->get( 'ShellRestrictionMethod');$factory=new CommandFactory( $services->getShellboxClientFactory(), $limits, $cgroup, $restrictionMethod);$factory->setLogger(LoggerFactory::getInstance( 'exec'));$factory->logStderr();return $factory;}, '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( 'SkipSkins'));$names=$services->getMainConfig() ->get( 'ValidSkinNames');foreach( $names as $name=> $skin) { if(is_array( $skin)) { $spec=$skin;$displayName=$skin['displayname'] ?? $name;} else { $displayName=$skin;$spec=['name'=> $name, 'class'=> "Skin$skin"];} $factory->register( $name, $displayName, $spec);} $factory->register( 'fallback', 'Fallback', ['class'=> SkinFallback::class, 'args'=>[['name'=> 'fallback', 'styles'=>[ 'mediawiki.skinning.interface'], 'templateDirectory'=> __DIR__ . '/skins/templates/fallback',]]]);$factory->register( 'apioutput', 'ApiOutput', ['class'=> SkinApi::class, 'args'=>[['name'=> 'apioutput', 'styles'=>[ 'mediawiki.skinning.interface'], 'templateDirectory'=> __DIR__ . '/skins/templates/apioutput',]]]);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( '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( 'SpamRegex'),(array) $services->getMainConfig() ->get( '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( 'StatsdMetricPrefix'), '.'));}, 'TalkPageNotificationManager'=> static function(MediaWikiServices $services):TalkPageNotificationManager { return new TalkPageNotificationManager(new ServiceOptions(TalkPageNotificationManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancer(), $services->getReadOnlyMode(), $services->getRevisionLookup());}, 'TempFSFileFactory'=> static function(MediaWikiServices $services):TempFSFileFactory { return new TempFSFileFactory( $services->getMainConfig() ->get( 'TmpDirectory'));}, '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');}, 'UnblockUserFactory'=> static function(MediaWikiServices $services):UnblockUserFactory { return $services->getService( '_UserBlockCommandFactory');}, 'UploadRevisionImporter'=> static function(MediaWikiServices $services):UploadRevisionImporter { return new ImportableUploadRevisionImporter($services->getMainConfig() ->get( 'EnableUploads'), LoggerFactory::getInstance( 'UploadRevisionImporter'));}, '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'), [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->getUserFactory(), $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());}, '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());}, 'VirtualRESTServiceClient'=> static function(MediaWikiServices $services):VirtualRESTServiceClient { $config=$services->getMainConfig() ->get( '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->getMainConfig() ->get( 'WatchlistExpiry'), $services->getMainConfig() ->get( '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->getHookContainer(), $services->getLinkBatchFactory(), $services->getUserFactory(), $services->getTitleFactory());$store->setStatsdDataFactory( $services->getStatsdDataFactory());if( $services->getMainConfig() ->get( '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());}, '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());}, '_DefaultOptionsLookup'=> static function(MediaWikiServices $services):DefaultOptionsLookup { return new DefaultOptionsLookup(new ServiceOptions(DefaultOptionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), $services->getHookContainer());}, '_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( '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(), ObjectCache::getInstance( 'db-replicated'), WikiMap::getCurrentWikiDbDomain() ->getId(), WebRequest::getRequestId(), $services->getBacklinkCacheFactory());}, '_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
$IP
Definition WebStart.php:49
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:86
get( $key, $flags=0)
Get an item with the given key.
A factory for application metric data.
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:38
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.
Key/value blob storage for a collection of storage medium types (e.g.
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:41
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition Language.php:42
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition LinkCache.php:41
Class for caching the contents of localisation files, Messages*.php and *.i18n.php.
static getStoreFromConf(array $conf, $fallbackCacheDir)
Return a suitable LCStore as specified by the given configuration.
static setDomainAliases(ILBFactory $lbFactory)
const APPLY_DEFAULT_CONFIG_OPTIONS
static applyDefaultConfig(array $lbConf, ServiceOptions $options, ConfiguredReadOnlyMode $readOnlyMode, BagOStuff $cpStash, BagOStuff $srvCache, WANObjectCache $wanCache, CriticalSectionProvider $csProvider)
static getLBFactoryClass(array $config)
Decide which LBFactory class to use.
static applyGlobalState(ILBFactory $lbFactory, Config $config, IBufferingStatsdDataFactory $stats)
Apply global state from the current web request or other PHP process.
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.
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.
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 links for pages.
PSR-3 logger instance factory.
MediaWikiServices is the service locator for the application scope of MediaWiki.
The MediaWiki-specific implementation of IMessageFormatterFactory.
Common factory to construct page handling classes.
Service for getting rendered output of a given page.
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...
This is the default implementation of PreferencesFactory.
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.
Class for managing stashed edits used by the page updater classes.
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.
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.
static clearGlobalCacheEntry(WANObjectCache $cache)
Invalidate cache keys for all known modules.
Cache of 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:138
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:91
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:33
Group all the pieces relevant to the context of a request into one instance @newable.
ResourceLoader is a loading system for JavaScript and CSS resources.
Configuration handling class for SearchEngine.
Factory class for SearchEngine.
Factory class to create Skin objects.
register( $name, $displayName, $spec)
Register a new Skin factory function.
Creates Title objects.
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
Lightweight class for tracking path dependencies lists via an object cache instance.
Class for tracking per-entity dependency path lists in the module_deps table.
Class for getting statistically unique IDs without a central coordinator.
Interface for configuration instances.
Definition Config.php:30
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
Service interface for looking up Interwiki records.
Interface for sending emails.
Definition IEmailer.php:34
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.
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