47use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
117use Wikimedia\ObjectFactory;
118use Wikimedia\Services\RecursiveServiceDependencyException;
129 $services->getMainConfig(),
130 $services->getObjectFactory(),
132 $services->getHookContainer()
134 $authManager->
setLogger( LoggerFactory::getInstance(
'authentication' ) );
141 return wfMessage(
'bad_image_list' )->inContentLanguage()->plain();
143 $services->getLocalServerObjectCache(),
144 $services->getRepoGroup(),
145 $services->getTitleParser(),
146 $services->getHookContainer()
151 return $services->getService(
'_SqlBlobStore' );
156 $services->getDBLoadBalancerFactory(),
157 $services->getExternalStoreAccess(),
158 $services->getMainWANObjectCache(),
160 $services->getMainConfig() )
172 $services->getMainConfig()
176 $services->getHookContainer()
180 'BlockPermissionCheckerFactory' =>
function (
190 $services->getDBLoadBalancer()
195 return $services->getNameTableStoreFactory()->getChangeTagDef();
200 $services->getContentLanguage(),
207 $registry = $services->getBootstrapConfig()->get(
'ConfigRegistry' );
210 foreach ( $registry as $name => $callback ) {
211 $factory->register( $name, $callback );
221 $config = $services->getMainConfig();
223 $config->get(
'ReadOnly' ),
224 $config->get(
'ReadOnlyFile' )
229 $contentHandlerConfig = $services->getMainConfig()->get(
'ContentHandlers' );
232 $contentHandlerConfig,
233 $services->getObjectFactory(),
234 $services->getHookContainer(),
235 LoggerFactory::getInstance(
'ContentHandler' )
240 return $services->getLanguageFactory()->getLanguage(
241 $services->getMainConfig()->get(
'LanguageCode' ) );
245 return $services->getService(
'_PageCommandFactory' );
249 return $services->getNameTableStoreFactory()->getContentModels();
257 $config = $services->getMainConfig();
259 $secret = $config->get(
'HKDFSecret' ) ?: $config->get(
'SecretKey' );
261 throw new RuntimeException(
"Cannot use MWCryptHKDF without a secret." );
266 $context = [ microtime(), getmypid(), gethostname() ];
269 $cache = $services->getLocalServerObjectCache();
274 return new CryptHKDF( $secret, $config->get(
'HKDFAlgorithm' ),
$cache, $context );
283 return $services->getDBLoadBalancerFactory()->getMainLB();
286 'DBLoadBalancerFactory' =>
288 $mainConfig = $services->getMainConfig();
291 $stash = $services->getMainObjectStash();
292 }
catch ( RecursiveServiceDependencyException $e ) {
302 $wanCache = $services->getMainWANObjectCache();
303 }
catch ( RecursiveServiceDependencyException $e ) {
308 $mainConfig->get(
'LBFactoryConf' ),
309 new ServiceOptions( MWLBFactory::APPLY_DEFAULT_CONFIG_OPTIONS, $mainConfig ),
310 $services->getConfiguredReadOnlyMode(),
311 $services->getLocalServerObjectCache(),
317 $instance =
new $class( $lbConf );
334 $services->getExternalStoreFactory(),
340 $config = $services->getMainConfig();
341 $writeStores = $config->get(
'DefaultExternalStore' );
344 $config->get(
'ExternalStores' ),
345 ( $writeStores !==
false ) ? (array)$writeStores : [],
346 $services->getDBLoadBalancer()->getLocalDomainID(),
352 $mainConfig = $services->getMainConfig();
359 $legacyDomainId = strlen( $ld->getTablePrefix() )
360 ?
"{$ld->getDatabase()}-{$ld->getTablePrefix()}"
361 : $ld->getDatabase();
362 if ( $ld->getSchema() !==
null && $legacyDomainId !== $fallbackWikiId ) {
364 "Legacy default 'domainId' is '$legacyDomainId' but wiki ID is '$fallbackWikiId'."
368 $cache = $services->getLocalServerObjectCache();
374 new ServiceOptions( FileBackendGroup::CONSTRUCTOR_OPTIONS, $mainConfig,
375 [
'fallbackWikiId' => $fallbackWikiId ] ),
376 $services->getConfiguredReadOnlyMode(),
378 $services->getMainWANObjectCache(),
379 $services->getMimeAnalyzer(),
380 $services->getLockManagerGroupFactory(),
381 $services->getTempFSFileFactory(),
382 $services->getObjectFactory()
387 $nsInfo = $services->getNamespaceInfo();
389 $dbLoadBalancer = $services->isServiceDisabled(
'DBLoadBalancer' )
391 : $services->getDBLoadBalancer();
392 return new GenderCache( $nsInfo, $dbLoadBalancer, $services->get(
'_DefaultOptionsLookup' ) );
396 $mainConfig = $services->getMainConfig();
399 $mainConfig->get(
'TmpDirectory' ),
403 $mainConfig->get(
'CommandLineMode' )
405 : $services->getLocalServerObjectCache(),
414 $extDeprecatedHooks = $extRegistry->
getAttribute(
'DeprecatedHooks' );
419 $services->getObjectFactory()
424 $config = $services->getMainConfig();
427 $services->getHookContainer(),
428 $config->get(
'CdnReboundPurgeDelay' ),
429 $config->get(
'UseFileCache' ),
430 $config->get(
'CdnMaxAge' )
434 'HttpRequestFactory' =>
439 $services->getMainConfig()
446 $config = $services->getMainConfig();
448 $services->getContentLanguage(),
449 $services->getMainWANObjectCache(),
450 $services->getHookContainer(),
451 $config->get(
'InterwikiExpiry' ),
452 $config->get(
'InterwikiCache' ),
453 $config->get(
'InterwikiScopes' ),
454 $config->get(
'InterwikiFallbackSite' )
461 $services->getDBLoadBalancerFactory(),
463 $services->getReadOnlyMode(),
464 $services->getLinkCache(),
465 $services->getStatsdDataFactory(),
471 $usePigLatinVariant = $services->getMainConfig()->get(
'UsePigLatinVariant' );
473 return $services->getContentLanguage();
480 $services->getLocalisationCache(),
481 $services->getLanguageNameUtils(),
482 $services->getLanguageFallback(),
483 $services->getLanguageConverterFactory(),
484 $services->getHookContainer()
490 $services->getMainConfig()->get(
'LanguageCode' ),
491 $services->getLocalisationCache(),
492 $services->getLanguageNameUtils()
500 $services->getMainConfig()
502 $services->getHookContainer()
508 $services->getLinkCache(),
509 $services->getTitleFormatter(),
510 $services->getContentLanguage(),
511 $services->getGenderCache(),
512 $services->getDBLoadBalancer()
518 $services->getTitleFormatter(),
519 $services->getMainWANObjectCache(),
520 $services->getNamespaceInfo()
525 if ( defined(
'MW_NO_SESSION' ) ) {
526 return $services->getLinkRendererFactory()->create();
530 return $services->getLinkRendererFactory()->createForUser(
531 RequestContext::getMain()->
getUser()
538 $services->getTitleFormatter(),
539 $services->getLinkCache(),
540 $services->getNamespaceInfo(),
541 $services->getSpecialPageFactory(),
542 $services->getHookContainer()
547 $conf = $services->getMainConfig()->get(
'LocalisationCacheConf' );
549 $logger = LoggerFactory::getInstance(
'localisation' );
552 $conf, $services->getMainConfig()->get(
'CacheDirectory' ) );
553 $logger->debug(
'LocalisationCache using store ' . get_class( $store ) );
555 return new $conf[
'class'](
557 LocalisationCache::CONSTRUCTOR_OPTIONS,
562 'forceRecache' =>
false,
563 'manualRecache' =>
false,
566 $services->getMainConfig()
570 [
function () use ( $services ) {
576 $services->getLanguageNameUtils(),
577 $services->getHookContainer()
587 WikiMap::getCurrentWikiDbDomain()->getId(),
588 $services->getMainConfig()->get(
'LockManagers' ),
589 $services->getDBLoadBalancerFactory()
595 $services->getContentLanguage(),
596 $services->getHookContainer()
602 return $services->getConfigFactory()->makeConfig(
'main' );
606 $mainConfig = $services->getMainConfig();
608 $id = $mainConfig->
get(
'MainStash' );
609 if ( !isset( $mainConfig->get(
'ObjectCaches' )[$id] ) ) {
610 throw new UnexpectedValueException(
611 "Cache type \"$id\" is not present in \$wgObjectCaches." );
614 $params = $mainConfig->get(
'ObjectCaches' )[$id];
617 $store->getLogger()->debug(
'MainObjectStash using store {class}', [
618 'class' => get_class( $store )
625 $mainConfig = $services->getMainConfig();
627 $wanId = $mainConfig->
get(
'MainWANCache' );
628 $wanParams = $mainConfig->get(
'WANObjectCaches' )[$wanId] ??
null;
630 throw new UnexpectedValueException(
631 "wgWANObjectCaches must have \"$wanId\" set (via wgMainWANCache)"
635 $cacheId = $wanParams[
'cacheId'];
636 $wanClass = $wanParams[
'class'];
637 unset( $wanParams[
'cacheId'] );
638 unset( $wanParams[
'class'] );
640 $storeParams = $mainConfig->get(
'ObjectCaches' )[$cacheId] ??
null;
641 if ( !$storeParams ) {
642 throw new UnexpectedValueException(
643 "wgObjectCaches must have \"$cacheId\" set (via wgWANObjectCaches)"
647 $logger = $store->getLogger();
648 $logger->debug(
'MainWANObjectCache using store {class}', [
649 'class' => get_class( $store )
652 $wanParams[
'cache'] = $store;
653 $wanParams[
'logger'] = $logger;
654 $wanParams[
'secret'] = $wanParams[
'secret'] ?? $mainConfig->get(
'SecretKey' );
655 if ( !$mainConfig->get(
'CommandLineMode' ) ) {
657 $wanParams[
'stats'] = $services->getStatsdDataFactory();
659 $wanParams[
'asyncHandler'] = [ DeferredUpdates::class,
'addCallableUpdate' ];
662 $instance =
new $wanClass( $wanParams );
664 '@phan-var WANObjectCache $instance';
670 $services->getMainConfig()->get(
'MediaHandlers' )
675 return $services->getService(
'_PageCommandFactory' );
679 $mainConfig = $services->getMainConfig();
681 $srvCache = $mainConfig->get(
'UseLocalMessageCache' )
682 ? $services->getLocalServerObjectCache()
685 $logger = LoggerFactory::getInstance(
'MessageCache' );
686 $logger->debug(
'MessageCache using store {class}', [
687 'class' => get_class( $clusterCache )
691 $services->getMainWANObjectCache(),
694 $services->getContentLanguage(),
695 $services->getLanguageConverterFactory()->getLanguageConverter(),
697 [
'useDB' => $mainConfig->get(
'UseDatabaseMessages' ) ],
698 $services->getLanguageFactory(),
699 $services->getLocalisationCache(),
700 $services->getLanguageNameUtils(),
701 $services->getLanguageFallback(),
702 $services->getHookContainer()
712 $mainConfig = $services->getMainConfig();
713 $hookRunner =
new HookRunner( $services->getHookContainer() );
715 'typeFile' => $mainConfig->get(
'MimeTypeFile' ),
716 'infoFile' => $mainConfig->get(
'MimeInfoFile' ),
717 'xmlTypes' => $mainConfig->get(
'XMLMimeTypes' ),
719 function ( $mimeAnalyzer, &$head, &$tail,
$file, &
$mime )
720 use ( $logger, $hookRunner ) {
723 if ( $deja->isValid() ) {
724 $logger->info(
"Detected $file as image/vnd.djvu\n" );
725 $mime =
'image/vnd.djvu';
730 $hookRunner->onMimeMagicGuessFromContent(
733 'extCallback' =>
function ( $mimeAnalyzer,
$ext, &
$mime ) use ( $hookRunner ) {
735 $hookRunner->onMimeMagicImproveFromExtension( $mimeAnalyzer,
$ext,
$mime );
737 'initCallback' =>
function ( $mimeAnalyzer ) use ( $hookRunner ) {
739 $hookRunner->onMimeMagicInit( $mimeAnalyzer );
744 if ( $params[
'infoFile'] ===
'includes/mime.info' ) {
745 $params[
'infoFile'] = MimeAnalyzer::USE_INTERNAL;
748 if ( $params[
'typeFile'] ===
'includes/mime.types' ) {
749 $params[
'typeFile'] = MimeAnalyzer::USE_INTERNAL;
752 $detectorCmd = $mainConfig->get(
'MimeDetectorCommand' );
753 if ( $detectorCmd ) {
754 $factory = $services->getShellCommandFactory();
755 $params[
'detectCallback'] =
function (
$file ) use ( $detectorCmd, $factory ) {
756 $result = $factory->create()
758 ->unsafeParams( $detectorCmd )
761 return $result->getStdout();
765 return new MimeAnalyzer( $params );
769 return $services->getService(
'_PageCommandFactory' );
775 $services->getHookContainer()
781 $services->getDBLoadBalancerFactory(),
782 $services->getMainWANObjectCache(),
788 return new ObjectFactory( $services );
795 $services->getDBLoadBalancer(),
796 $services->getRevisionStore(),
797 $services->getSlotRoleRegistry()
802 $config = $services->getMainConfig();
805 ObjectCache::getLocalClusterInstance(),
806 $services->getDBLoadBalancer(),
807 LoggerFactory::getInstance(
'StashEdit' ),
808 $services->getStatsdDataFactory(),
809 $services->getHookContainer(),
810 defined(
'MEDIAWIKI_JOB_RUNNER' ) || $config->get(
'CommandLineMode' )
811 ? PageEditStash::INITIATOR_JOB_OR_CLI
817 return $services->getParserFactory()->create();
821 $config = $services->getMainConfig();
827 $config->get(
'CacheEpoch' ),
828 $services->getHookContainer(),
829 $services->getStatsdDataFactory()
840 $services->getMainConfig()->get(
'ParserConf' ),
842 [
'class' =>
Parser::class ],
844 $services->getMainConfig()
849 $services->getMagicWordFactory(),
850 $services->getContentLanguage(),
852 $services->getSpecialPageFactory(),
853 $services->getLinkRendererFactory(),
854 $services->getNamespaceInfo(),
855 LoggerFactory::getInstance(
'Parser' ),
856 $services->getBadFileLookup(),
857 $services->getLanguageConverterFactory(),
858 $services->getHookContainer()
863 $config = $services->getMainConfig();
865 $config->get(
'PasswordConfig' ),
866 $config->get(
'PasswordDefault' )
874 $services->getAuthManager(),
875 $services->getPermissionManager(),
876 $services->getDBLoadBalancer(),
877 LoggerFactory::getInstance(
'authentication' ),
878 $services->getHookContainer()
882 'PerDbNameStatsdDataFactory' =>
884 $config = $services->getMainConfig();
885 $wiki = $config->get(
'DBname' );
887 $services->getStatsdDataFactory(),
897 $services->getSpecialPageFactory(),
898 $services->getRevisionLookup(),
899 $services->getNamespaceInfo(),
900 $services->getBlockErrorFormatter(),
901 $services->getHookContainer()
909 $services->getContentLanguage(),
910 $services->getAuthManager(),
911 $services->getLinkRendererFactory()->create(),
912 $services->getNamespaceInfo(),
914 $services->getLanguageConverterFactory()->getLanguageConverter(),
915 $services->getLanguageNameUtils(),
916 $services->getHookContainer()
918 $factory->setLogger( LoggerFactory::getInstance(
'preferences' ) );
924 $mainConfig = $services->getMainConfig();
926 $mainConfig->get(
'CdnServers' ),
927 $mainConfig->get(
'CdnServersNoPurge' )
933 $services->getConfiguredReadOnlyMode(),
934 $services->getDBLoadBalancer()
939 $config = $services->getMainConfig();
941 $config->get(
'LocalFileRepo' ),
942 $config->get(
'ForeignFileRepos' ),
943 $services->getMainWANObjectCache()
951 $config = $services->getMainConfig();
955 LoggerFactory::getInstance(
'resourceloader' ),
956 $config->get(
'ResourceLoaderUseObjectCacheForDeps' )
963 $modules = $extRegistry->getAttribute(
'ResourceModules' )
964 + $config->get(
'ResourceModules' );
965 $moduleSkinStyles = $extRegistry->getAttribute(
'ResourceModuleSkinStyles' )
966 + $config->get(
'ResourceModuleSkinStyles' );
968 $rl->setModuleSkinStyles( $moduleSkinStyles );
969 $rl->addSource( $config->get(
'ResourceLoaderSources' ) );
972 $rl->register( include
"$IP/resources/Resources.php" );
974 $hookRunner = new \MediaWiki\ResourceLoader\HookRunner( $services->getHookContainer() );
975 $hookRunner->onResourceLoaderRegisterModules( $rl );
977 $msgPosterAttrib = $extRegistry->getAttribute(
'MessagePosterModule' );
978 $rl->register(
'mediawiki.messagePoster', [
979 'localBasePath' =>
$IP,
981 'scripts' => array_merge(
983 "resources/src/mediawiki.messagePoster/factory.js",
984 "resources/src/mediawiki.messagePoster/MessagePoster.js",
985 "resources/src/mediawiki.messagePoster/WikitextMessagePoster.js",
987 $msgPosterAttrib[
'scripts'] ?? []
989 'dependencies' => array_merge(
993 'mediawiki.ForeignApi',
995 $msgPosterAttrib[
'dependencies'] ?? []
997 'targets' => [
'desktop',
'mobile' ],
1000 if ( $config->get(
'EnableJavaScriptTest' ) ===
true ) {
1001 $rl->registerTestModules();
1008 return $services->getRevisionStore();
1012 return $services->getRevisionStore();
1017 $services->getDBLoadBalancer(),
1018 $services->getSlotRoleRegistry()
1021 $renderer->
setLogger( LoggerFactory::getInstance(
'SaveParse' ) );
1026 return $services->getRevisionStoreFactory()->getRevisionStore();
1030 $config = $services->getMainConfig();
1032 if ( $config->has(
'MultiContentRevisionSchemaMigrationStage' ) ) {
1033 if ( $config->get(
'MultiContentRevisionSchemaMigrationStage' ) !==
SCHEMA_COMPAT_NEW ) {
1034 throw new UnexpectedValueException(
1035 'The MultiContentRevisionSchemaMigrationStage setting is no longer supported!'
1041 $services->getDBLoadBalancerFactory(),
1042 $services->getBlobStoreFactory(),
1043 $services->getNameTableStoreFactory(),
1044 $services->getSlotRoleRegistry(),
1045 $services->getMainWANObjectCache(),
1046 $services->getCommentStore(),
1047 $services->getActorMigration(),
1048 LoggerFactory::getInstance(
'RevisionStore' ),
1049 $services->getContentHandlerFactory(),
1050 $services->getHookContainer()
1060 $services->getMainConfig(),
1061 $services->getContentLanguage(),
1062 $services->getHookContainer(),
1069 $services->getSearchEngineConfig(),
1070 $services->getHookContainer()
1075 $config = $services->getMainConfig();
1078 'time' => $config->get(
'MaxShellTime' ),
1079 'walltime' => $config->get(
'MaxShellWallClockTime' ),
1080 'memory' => $config->get(
'MaxShellMemory' ),
1081 'filesize' => $config->get(
'MaxShellFileSize' ),
1083 $cgroup = $config->get(
'ShellCgroup' );
1084 $restrictionMethod = $config->get(
'ShellRestrictionMethod' );
1086 $factory =
new CommandFactory( $limits, $cgroup, $restrictionMethod );
1087 $factory->setLogger( LoggerFactory::getInstance(
'exec' ) );
1088 $factory->logStderr();
1097 return $services->getSiteStore();
1101 $rawSiteStore = new
DBSiteStore( $services->getDBLoadBalancer() );
1103 $cache = $services->getLocalServerObjectCache();
1113 $factory = new
SkinFactory( $services->getObjectFactory() );
1115 $names = $services->getMainConfig()->get(
'ValidSkinNames' );
1117 foreach ( $names as $name => $skin ) {
1118 if ( is_array( $skin ) ) {
1120 $displayName = $skin[
'displayname'] ?? $name;
1122 $displayName = $skin;
1124 'class' =>
"Skin$skin"
1127 $factory->
register( $name, $displayName, $spec );
1131 $factory->register(
'fallback',
'Fallback', [
1132 'class' => SkinFallback::class,
1135 'styles' => [
'mediawiki.skinning.interface' ],
1136 'templateDirectory' => __DIR__ .
'/skins/templates/fallback',
1141 $factory->register(
'apioutput',
'ApiOutput', [
1142 'class' => SkinApi::class,
1145 'styles' => [
'mediawiki.skinning.interface' ],
1146 'templateDirectory' => __DIR__ .
'/skins/templates/apioutput',
1155 $config = $services->getMainConfig();
1156 $contentHandlerFactory = $services->getContentHandlerFactory();
1159 $services->getSlotRoleStore()
1162 $registry->defineRole(
'main',
function () use ( $config, $contentHandlerFactory ) {
1164 $config->get(
'NamespaceContentModels' ),
1165 $contentHandlerFactory
1173 return $services->getNameTableStoreFactory()->getSlotRoles();
1178 (array)$services->getMainConfig()->get(
'SpamRegex' ),
1179 (array)$services->getMainConfig()->get(
'SummarySpamRegex' )
1187 $services->getContentLanguage(),
1188 $services->getObjectFactory(),
1189 $services->getHookContainer()
1195 rtrim( $services->getMainConfig()->get(
'StatsdMetricPrefix' ),
'.' )
1199 'TalkPageNotificationManager' =>
function (
1206 $services->getDBLoadBalancer(),
1207 $services->getReadOnlyMode(),
1208 $services->getRevisionLookup()
1221 return $services->getService(
'_MediaWikiTitleCodec' );
1225 return $services->getService(
'_MediaWikiTitleCodec' );
1230 $services->getMainConfig()->get(
'EnableUploads' ),
1237 $services->getActorMigration(),
1238 $services->getDBLoadBalancer()
1247 return $services->getUserGroupManagerFactory()->getUserGroupManager();
1255 $services->getConfiguredReadOnlyMode(),
1256 $services->getDBLoadBalancerFactory(),
1257 $services->getHookContainer(),
1258 $services->getUserEditTracker(),
1261 $services->getPermissionManager()->invalidateUsersRightsCache( $user );
1271 UserNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1273 $services->getContentLanguage(),
1274 LoggerFactory::getInstance(
'UserNameUtils' ),
1275 $services->getTitleParser(),
1276 $messageFormatterFactory->getTextFormatter(
1277 $services->getContentLanguage()->getCode()
1279 $services->getHookContainer()
1284 return $services->getUserOptionsManager();
1290 $services->get(
'_DefaultOptionsLookup' ),
1291 $services->getLanguageConverterFactory(),
1292 $services->getDBLoadBalancer(),
1294 $services->getHookContainer()
1298 'VirtualRESTServiceClient' =>
1300 $config = $services->getMainConfig()->get(
'VirtualRestConfig' );
1303 $services->getHttpRequestFactory()->createMultiClient() );
1304 foreach ( $config[
'paths'] as $prefix => $serviceConfig ) {
1305 $class = $serviceConfig[
'class'];
1307 $constructArg = $serviceConfig[
'options'] ?? [];
1308 $constructArg += $config[
'global'];
1310 $vrsClient->mount( $prefix, [
'class' => $class,
'config' => $constructArg ] );
1316 'WatchedItemQueryService' =>
1319 $services->getDBLoadBalancer(),
1320 $services->getCommentStore(),
1321 $services->getActorMigration(),
1322 $services->getWatchedItemStore(),
1324 $services->getHookContainer(),
1325 $services->getMainConfig()->get(
'WatchlistExpiry' ),
1326 $services->getMainConfig()->get(
'MaxExecutionTimeForExpensiveQueries' )
1333 $services->getMainConfig() ),
1334 $services->getDBLoadBalancerFactory(),
1336 $services->getMainObjectStash(),
1338 $services->getReadOnlyMode(),
1339 $services->getNamespaceInfo(),
1340 $services->getRevisionLookup(),
1341 $services->getHookContainer()
1345 if ( $services->getMainConfig()->get(
'ReadOnlyWatchedItemStore' ) ) {
1352 'WatchlistNotificationManager' =>
1357 $services->getMainConfig()
1359 $services->getHookContainer(),
1361 $services->getReadOnlyMode(),
1362 $services->getRevisionLookup(),
1363 $services->getTalkPageNotificationManager(),
1364 $services->getWatchedItemStore()
1368 'WikiRevisionOldRevisionImporterNoUpdates' =>
1373 $services->getDBLoadBalancer(),
1374 $services->getRevisionStore(),
1375 $services->getSlotRoleRegistry()
1382 $services->getContentLanguage(),
1383 $services->getHookContainer()
1389 $services->getContentLanguage(),
1390 $services->getGenderCache(),
1391 $services->getMainConfig()->get(
'LocalInterwikis' ),
1392 $services->getInterwikiLookup(),
1393 $services->getNamespaceInfo()
1400 $services->getDBLoadBalancer(),
1401 $services->getNamespaceInfo(),
1402 $services->getWatchedItemStore(),
1404 $services->getRepoGroup(),
1405 $services->getContentHandlerFactory(),
1406 $services->getRevisionStore(),
1407 $services->getSpamChecker(),
1408 $services->getHookContainer()
1413 return $services->getBlobStoreFactory()->newSqlBlobStore();
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.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
return[ 'ActorMigration'=> function() :ActorMigration { return new ActorMigration(SCHEMA_COMPAT_NEW);}, 'AuthManager'=> function(MediaWikiServices $services) :AuthManager { $authManager=new AuthManager(RequestContext::getMain() ->getRequest(), $services->getMainConfig(), $services->getObjectFactory(), $services->getPermissionManager(), $services->getHookContainer());$authManager->setLogger(LoggerFactory::getInstance( 'authentication'));return $authManager;}, 'BadFileLookup'=> function(MediaWikiServices $services) :BadFileLookup { return new BadFileLookup(function() { return wfMessage( 'bad_image_list') ->inContentLanguage() ->plain();}, $services->getLocalServerObjectCache(), $services->getRepoGroup(), $services->getTitleParser(), $services->getHookContainer());}, 'BlobStore'=> function(MediaWikiServices $services) :BlobStore { return $services->getService( '_SqlBlobStore');}, 'BlobStoreFactory'=> function(MediaWikiServices $services) :BlobStoreFactory { return new BlobStoreFactory($services->getDBLoadBalancerFactory(), $services->getExternalStoreAccess(), $services->getMainWANObjectCache(), new ServiceOptions(BlobStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'BlockErrorFormatter'=> function() :BlockErrorFormatter { return new BlockErrorFormatter();}, 'BlockManager'=> function(MediaWikiServices $services) :BlockManager { return new BlockManager(new ServiceOptions(BlockManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getPermissionManager(), LoggerFactory::getInstance( 'BlockManager'), $services->getHookContainer());}, 'BlockPermissionCheckerFactory'=> function(MediaWikiServices $services) :BlockPermissionCheckerFactory { return new BlockPermissionCheckerFactory($services->getPermissionManager());}, 'BlockRestrictionStore'=> function(MediaWikiServices $services) :BlockRestrictionStore { return new BlockRestrictionStore($services->getDBLoadBalancer());}, 'ChangeTagDefStore'=> function(MediaWikiServices $services) :NameTableStore { return $services->getNameTableStoreFactory() ->getChangeTagDef();}, 'CommentStore'=> function(MediaWikiServices $services) :CommentStore { return new CommentStore($services->getContentLanguage(), MIGRATION_NEW);}, 'ConfigFactory'=> function(MediaWikiServices $services) :ConfigFactory { $registry=$services->getBootstrapConfig() ->get( 'ConfigRegistry');$factory=new ConfigFactory();foreach( $registry as $name=> $callback) { $factory->register( $name, $callback);} return $factory;}, 'ConfigRepository'=> function(MediaWikiServices $services) :ConfigRepository { return new ConfigRepository( $services->getConfigFactory());}, 'ConfiguredReadOnlyMode'=> function(MediaWikiServices $services) :ConfiguredReadOnlyMode { $config=$services->getMainConfig();return new ConfiguredReadOnlyMode($config->get( 'ReadOnly'), $config->get( 'ReadOnlyFile'));}, 'ContentHandlerFactory'=> function(MediaWikiServices $services) :IContentHandlerFactory { $contentHandlerConfig=$services->getMainConfig() ->get( 'ContentHandlers');return new ContentHandlerFactory($contentHandlerConfig, $services->getObjectFactory(), $services->getHookContainer(), LoggerFactory::getInstance( 'ContentHandler'));}, 'ContentLanguage'=> function(MediaWikiServices $services) :Language { return $services->getLanguageFactory() ->getLanguage($services->getMainConfig() ->get( 'LanguageCode'));}, 'ContentModelChangeFactory'=> function(MediaWikiServices $services) :ContentModelChangeFactory { return $services->getService( '_PageCommandFactory');}, 'ContentModelStore'=> function(MediaWikiServices $services) :NameTableStore { return $services->getNameTableStoreFactory() ->getContentModels();}, 'ContributionsLookup'=> function(MediaWikiServices $services) :ContributionsLookup { return new ContributionsLookup( $services->getRevisionStore());}, 'CryptHKDF'=> 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);}, 'DateFormatterFactory'=> function() :DateFormatterFactory { return new DateFormatterFactory;}, 'DBLoadBalancer'=> function(MediaWikiServices $services) :Wikimedia\Rdbms\ILoadBalancer { return $services->getDBLoadBalancerFactory() ->getMainLB();}, 'DBLoadBalancerFactory'=> function(MediaWikiServices $services) :Wikimedia\Rdbms\LBFactory { $mainConfig=$services->getMainConfig();try { $stash=$services->getMainObjectStash();} catch(RecursiveServiceDependencyException $e) { $stash=new EmptyBagOStuff();} if( $stash instanceof EmptyBagOStuff) { $stash=new HashBagOStuff([ 'maxKeys'=> 100]);} try { $wanCache=$services->getMainWANObjectCache();} catch(RecursiveServiceDependencyException $e) { $wanCache=WANObjectCache::newEmpty();} $lbConf=MWLBFactory::applyDefaultConfig($mainConfig->get( 'LBFactoryConf'), new ServiceOptions(MWLBFactory::APPLY_DEFAULT_CONFIG_OPTIONS, $mainConfig), $services->getConfiguredReadOnlyMode(), $services->getLocalServerObjectCache(), $stash, $wanCache);$class=MWLBFactory::getLBFactoryClass( $lbConf);$instance=new $class( $lbConf);MWLBFactory::setDomainAliases( $instance);return $instance;}, 'Emailer'=> function(MediaWikiServices $services) :IEmailer { return new Emailer();}, 'EventRelayerGroup'=> function(MediaWikiServices $services) :EventRelayerGroup { return new EventRelayerGroup( $services->getMainConfig() ->get( 'EventRelayerConfig'));}, 'ExternalStoreAccess'=> function(MediaWikiServices $services) :ExternalStoreAccess { return new ExternalStoreAccess($services->getExternalStoreFactory(), LoggerFactory::getInstance( 'ExternalStore'));}, 'ExternalStoreFactory'=> 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'=> 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'=> function(MediaWikiServices $services) :GenderCache { $nsInfo=$services->getNamespaceInfo();$dbLoadBalancer=$services->isServiceDisabled( 'DBLoadBalancer') ? null :$services->getDBLoadBalancer();return new GenderCache( $nsInfo, $dbLoadBalancer, $services->get( '_DefaultOptionsLookup'));}, 'GlobalIdGenerator'=> function(MediaWikiServices $services) :GlobalIdGenerator { $mainConfig=$services->getMainConfig();return new GlobalIdGenerator($mainConfig->get( 'TmpDirectory'), $mainConfig->get( 'CommandLineMode') ? new EmptyBagOStuff() :$services->getLocalServerObjectCache(), function( $command) { return wfShellExec( $command);});}, 'HookContainer'=> 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'=> function(MediaWikiServices $services) :HtmlCacheUpdater { $config=$services->getMainConfig();return new HtmlCacheUpdater($services->getHookContainer(), $config->get( 'CdnReboundPurgeDelay'), $config->get( 'UseFileCache'), $config->get( 'CdnMaxAge'));}, 'HttpRequestFactory'=> function(MediaWikiServices $services) :HttpRequestFactory { return new HttpRequestFactory(new ServiceOptions(HttpRequestFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), LoggerFactory::getInstance( 'http'));}, 'InterwikiLookup'=> function(MediaWikiServices $services) :InterwikiLookup { $config=$services->getMainConfig();return new ClassicInterwikiLookup($services->getContentLanguage(), $services->getMainWANObjectCache(), $services->getHookContainer(), $config->get( 'InterwikiExpiry'), $config->get( 'InterwikiCache'), $config->get( 'InterwikiScopes'), $config->get( 'InterwikiFallbackSite'));}, 'JobRunner'=> function(MediaWikiServices $services) :JobRunner { return new JobRunner(new ServiceOptions(JobRunner::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancerFactory(), JobQueueGroup::singleton(), $services->getReadOnlyMode(), $services->getLinkCache(), $services->getStatsdDataFactory(), LoggerFactory::getInstance( 'runJobs'));}, 'LanguageConverterFactory'=> function(MediaWikiServices $services) :LanguageConverterFactory { $usePigLatinVariant=$services->getMainConfig() ->get( 'UsePigLatinVariant');return new LanguageConverterFactory( $usePigLatinVariant, function() use( $services) { return $services->getContentLanguage();});}, 'LanguageFactory'=> 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'=> function(MediaWikiServices $services) :LanguageFallback { return new LanguageFallback($services->getMainConfig() ->get( 'LanguageCode'), $services->getLocalisationCache(), $services->getLanguageNameUtils());}, 'LanguageNameUtils'=> function(MediaWikiServices $services) :LanguageNameUtils { return new LanguageNameUtils(new ServiceOptions(LanguageNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getHookContainer());}, 'LinkBatchFactory'=> function(MediaWikiServices $services) :LinkBatchFactory { return new LinkBatchFactory($services->getLinkCache(), $services->getTitleFormatter(), $services->getContentLanguage(), $services->getGenderCache(), $services->getDBLoadBalancer());}, 'LinkCache'=> function(MediaWikiServices $services) :LinkCache { return new LinkCache($services->getTitleFormatter(), $services->getMainWANObjectCache(), $services->getNamespaceInfo());}, 'LinkRenderer'=> function(MediaWikiServices $services) :LinkRenderer { if(defined( 'MW_NO_SESSION')) { return $services->getLinkRendererFactory() ->create();} else { return $services->getLinkRendererFactory() ->createForUser(RequestContext::getMain() ->getUser());} }, 'LinkRendererFactory'=> function(MediaWikiServices $services) :LinkRendererFactory { return new LinkRendererFactory($services->getTitleFormatter(), $services->getLinkCache(), $services->getNamespaceInfo(), $services->getSpecialPageFactory(), $services->getHookContainer());}, 'LocalisationCache'=> 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, [function() use( $services) { MessageBlobStore::clearGlobalCacheEntry( $services->getMainWANObjectCache());}], $services->getLanguageNameUtils(), $services->getHookContainer());}, 'LocalServerObjectCache'=> function(MediaWikiServices $services) :BagOStuff { return ObjectCache::makeLocalServerCache();}, 'LockManagerGroupFactory'=> function(MediaWikiServices $services) :LockManagerGroupFactory { return new LockManagerGroupFactory(WikiMap::getCurrentWikiDbDomain() ->getId(), $services->getMainConfig() ->get( 'LockManagers'), $services->getDBLoadBalancerFactory());}, 'MagicWordFactory'=> function(MediaWikiServices $services) :MagicWordFactory { return new MagicWordFactory($services->getContentLanguage(), $services->getHookContainer());}, 'MainConfig'=> function(MediaWikiServices $services) :Config { return $services->getConfigFactory() ->makeConfig( 'main');}, 'MainObjectStash'=> 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];$store=ObjectCache::newFromParams( $params, $mainConfig);$store->getLogger() ->debug( 'MainObjectStash using store {class}', ['class'=> get_class( $store)]);return $store;}, 'MainWANObjectCache'=> 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)");} $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'=> function(MediaWikiServices $services) :MediaHandlerFactory { return new MediaHandlerFactory($services->getMainConfig() ->get( 'MediaHandlers'));}, 'MergeHistoryFactory'=> function(MediaWikiServices $services) :MergeHistoryFactory { return $services->getService( '_PageCommandFactory');}, 'MessageCache'=> 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'=> function() :IMessageFormatterFactory { return new MessageFormatterFactory();}, 'MimeAnalyzer'=> 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'=> 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'=> function( $mimeAnalyzer, $ext, &$mime) use( $hookRunner) { $hookRunner->onMimeMagicImproveFromExtension( $mimeAnalyzer, $ext, $mime);}, 'initCallback'=> 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']=function( $file) use( $detectorCmd, $factory) { $result=$factory->create() ->unsafeParams( $detectorCmd) ->params( $file) ->execute();return $result->getStdout();};} return new MimeAnalyzer( $params);}, 'MovePageFactory'=> function(MediaWikiServices $services) :MovePageFactory { return $services->getService( '_PageCommandFactory');}, 'NamespaceInfo'=> function(MediaWikiServices $services) :NamespaceInfo { return new NamespaceInfo(new ServiceOptions(NamespaceInfo::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getHookContainer());}, 'NameTableStoreFactory'=> function(MediaWikiServices $services) :NameTableStoreFactory { return new NameTableStoreFactory($services->getDBLoadBalancerFactory(), $services->getMainWANObjectCache(), LoggerFactory::getInstance( 'NameTableSqlStore'));}, 'ObjectFactory'=> function(MediaWikiServices $services) :ObjectFactory { return new ObjectFactory( $services);}, 'OldRevisionImporter'=> function(MediaWikiServices $services) :OldRevisionImporter { return new ImportableOldRevisionImporter(true, LoggerFactory::getInstance( 'OldRevisionImporter'), $services->getDBLoadBalancer(), $services->getRevisionStore(), $services->getSlotRoleRegistry());}, 'PageEditStash'=> function(MediaWikiServices $services) :PageEditStash { $config=$services->getMainConfig();return new PageEditStash(ObjectCache::getLocalClusterInstance(), $services->getDBLoadBalancer(), LoggerFactory::getInstance( 'StashEdit'), $services->getStatsdDataFactory(), $services->getHookContainer(), defined( 'MEDIAWIKI_JOB_RUNNER')|| $config->get( 'CommandLineMode') ? PageEditStash::INITIATOR_JOB_OR_CLI :PageEditStash::INITIATOR_USER);}, 'Parser'=> function(MediaWikiServices $services) :Parser { return $services->getParserFactory() ->create();}, 'ParserCache'=> function(MediaWikiServices $services) :ParserCache { $config=$services->getMainConfig();$cache=ObjectCache::getInstance( $config->get( 'ParserCacheType'));wfDebugLog( 'caches', 'parser:' . get_class( $cache));return new ParserCache($cache, $config->get( 'CacheEpoch'), $services->getHookContainer(), $services->getStatsdDataFactory());}, 'ParserFactory'=> function(MediaWikiServices $services) :ParserFactory { $options=new ServiceOptions(Parser::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ->get( 'ParserConf'), [ 'class'=> Parser::class], $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());}, 'PasswordFactory'=> function(MediaWikiServices $services) :PasswordFactory { $config=$services->getMainConfig();return new PasswordFactory($config->get( 'PasswordConfig'), $config->get( 'PasswordDefault'));}, 'PasswordReset'=> function(MediaWikiServices $services) :PasswordReset { $options=new ServiceOptions(PasswordReset::CONSTRUCTOR_OPTIONS, $services->getMainConfig());return new PasswordReset($options, $services->getAuthManager(), $services->getPermissionManager(), $services->getDBLoadBalancer(), LoggerFactory::getInstance( 'authentication'), $services->getHookContainer());}, 'PerDbNameStatsdDataFactory'=> function(MediaWikiServices $services) :StatsdDataFactoryInterface { $config=$services->getMainConfig();$wiki=$config->get( 'DBname');return new PrefixingStatsdDataFactoryProxy($services->getStatsdDataFactory(), $wiki);}, 'PermissionManager'=> function(MediaWikiServices $services) :PermissionManager { return new PermissionManager(new ServiceOptions(PermissionManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getSpecialPageFactory(), $services->getRevisionLookup(), $services->getNamespaceInfo(), $services->getBlockErrorFormatter(), $services->getHookContainer());}, 'PreferencesFactory'=> 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());$factory->setLogger(LoggerFactory::getInstance( 'preferences'));return $factory;}, 'ProxyLookup'=> function(MediaWikiServices $services) :ProxyLookup { $mainConfig=$services->getMainConfig();return new ProxyLookup($mainConfig->get( 'CdnServers'), $mainConfig->get( 'CdnServersNoPurge'));}, 'ReadOnlyMode'=> function(MediaWikiServices $services) :ReadOnlyMode { return new ReadOnlyMode($services->getConfiguredReadOnlyMode(), $services->getDBLoadBalancer());}, 'RepoGroup'=> function(MediaWikiServices $services) :RepoGroup { $config=$services->getMainConfig();return new RepoGroup($config->get( 'LocalFileRepo'), $config->get( 'ForeignFileRepos'), $services->getMainWANObjectCache());}, 'ResourceLoader'=> 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;}, 'RevisionFactory'=> function(MediaWikiServices $services) :RevisionFactory { return $services->getRevisionStore();}, 'RevisionLookup'=> function(MediaWikiServices $services) :RevisionLookup { return $services->getRevisionStore();}, 'RevisionRenderer'=> function(MediaWikiServices $services) :RevisionRenderer { $renderer=new RevisionRenderer($services->getDBLoadBalancer(), $services->getSlotRoleRegistry());$renderer->setLogger(LoggerFactory::getInstance( 'SaveParse'));return $renderer;}, 'RevisionStore'=> function(MediaWikiServices $services) :RevisionStore { return $services->getRevisionStoreFactory() ->getRevisionStore();}, 'RevisionStoreFactory'=> 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(), LoggerFactory::getInstance( 'RevisionStore'), $services->getContentHandlerFactory(), $services->getHookContainer());return $store;}, 'SearchEngineConfig'=> function(MediaWikiServices $services) :SearchEngineConfig { return new SearchEngineConfig($services->getMainConfig(), $services->getContentLanguage(), $services->getHookContainer(), ExtensionRegistry::getInstance() ->getAttribute( 'SearchMappings'));}, 'SearchEngineFactory'=> function(MediaWikiServices $services) :SearchEngineFactory { return new SearchEngineFactory($services->getSearchEngineConfig(), $services->getHookContainer());}, 'ShellCommandFactory'=> 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( $limits, $cgroup, $restrictionMethod);$factory->setLogger(LoggerFactory::getInstance( 'exec'));$factory->logStderr();return $factory;}, 'SiteLookup'=> function(MediaWikiServices $services) :SiteLookup { return $services->getSiteStore();}, 'SiteStore'=> 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'=> function(MediaWikiServices $services) :SkinFactory { $factory=new SkinFactory( $services->getObjectFactory());$names=$services->getMainConfig() ->get( 'ValidSkinNames');foreach( $names as $name=> $skin) { if(is_array( $skin)) { $spec=$skin;$displayName=$skin['displayname'] ?? $name;} else { $displayName=$skin;$spec=['class'=> "Skin$skin"];} $factory->register( $name, $displayName, $spec);} $factory->register( 'fallback', 'Fallback', ['class'=> SkinFallback::class, 'args'=>[['styles'=>[ 'mediawiki.skinning.interface'], 'templateDirectory'=> __DIR__ . '/skins/templates/fallback',]]]);$factory->register( 'apioutput', 'ApiOutput', ['class'=> SkinApi::class, 'args'=>[['styles'=>[ 'mediawiki.skinning.interface'], 'templateDirectory'=> __DIR__ . '/skins/templates/apioutput',]]]);return $factory;}, 'SlotRoleRegistry'=> function(MediaWikiServices $services) :SlotRoleRegistry { $config=$services->getMainConfig();$contentHandlerFactory=$services->getContentHandlerFactory();$registry=new SlotRoleRegistry($services->getSlotRoleStore());$registry->defineRole( 'main', function() use( $config, $contentHandlerFactory) { return new MainSlotRoleHandler($config->get( 'NamespaceContentModels'), $contentHandlerFactory);});return $registry;}, 'SlotRoleStore'=> function(MediaWikiServices $services) :NameTableStore { return $services->getNameTableStoreFactory() ->getSlotRoles();}, 'SpamChecker'=> function(MediaWikiServices $services) :SpamChecker { return new SpamChecker((array) $services->getMainConfig() ->get( 'SpamRegex'),(array) $services->getMainConfig() ->get( 'SummarySpamRegex'));}, 'SpecialPageFactory'=> function(MediaWikiServices $services) :SpecialPageFactory { return new SpecialPageFactory(new ServiceOptions(SpecialPageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), $services->getObjectFactory(), $services->getHookContainer());}, 'StatsdDataFactory'=> function(MediaWikiServices $services) :IBufferingStatsdDataFactory { return new BufferingStatsdDataFactory(rtrim( $services->getMainConfig() ->get( 'StatsdMetricPrefix'), '.'));}, 'TalkPageNotificationManager'=> function(MediaWikiServices $services) :TalkPageNotificationManager { return new TalkPageNotificationManager(new ServiceOptions(TalkPageNotificationManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancer(), $services->getReadOnlyMode(), $services->getRevisionLookup());}, 'TempFSFileFactory'=> function(MediaWikiServices $services) :TempFSFileFactory { return new TempFSFileFactory( $services->getMainConfig() ->get( 'TmpDirectory'));}, 'TitleFactory'=> function() :TitleFactory { return new TitleFactory();}, 'TitleFormatter'=> function(MediaWikiServices $services) :TitleFormatter { return $services->getService( '_MediaWikiTitleCodec');}, 'TitleParser'=> function(MediaWikiServices $services) :TitleParser { return $services->getService( '_MediaWikiTitleCodec');}, 'UploadRevisionImporter'=> function(MediaWikiServices $services) :UploadRevisionImporter { return new ImportableUploadRevisionImporter($services->getMainConfig() ->get( 'EnableUploads'), LoggerFactory::getInstance( 'UploadRevisionImporter'));}, 'UserEditTracker'=> function(MediaWikiServices $services) :UserEditTracker { return new UserEditTracker($services->getActorMigration(), $services->getDBLoadBalancer());}, 'UserFactory'=> function(MediaWikiServices $services) :UserFactory { return new UserFactory( $services->getUserNameUtils());}, 'UserGroupManager'=> function(MediaWikiServices $services) :UserGroupManager { return $services->getUserGroupManagerFactory() ->getUserGroupManager();}, 'UserGroupManagerFactory'=> function(MediaWikiServices $services) :UserGroupManagerFactory { return new UserGroupManagerFactory(new ServiceOptions(UserGroupManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getConfiguredReadOnlyMode(), $services->getDBLoadBalancerFactory(), $services->getHookContainer(), $services->getUserEditTracker(), LoggerFactory::getInstance( 'UserGroupManager'), [function(UserIdentity $user) use( $services) { $services->getPermissionManager() ->invalidateUsersRightsCache( $user);User::newFromIdentity( $user) ->invalidateCache();}]);}, 'UserNameUtils'=> 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'=> function(MediaWikiServices $services) :UserOptionsLookup { return $services->getUserOptionsManager();}, 'UserOptionsManager'=> 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'=> 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'=> function(MediaWikiServices $services) :WatchedItemQueryService { return new WatchedItemQueryService($services->getDBLoadBalancer(), $services->getCommentStore(), $services->getActorMigration(), $services->getWatchedItemStore(), $services->getPermissionManager(), $services->getHookContainer(), $services->getMainConfig() ->get( 'WatchlistExpiry'), $services->getMainConfig() ->get( 'MaxExecutionTimeForExpensiveQueries'));}, 'WatchedItemStore'=> function(MediaWikiServices $services) :WatchedItemStore { $store=new WatchedItemStore(new ServiceOptions(WatchedItemStore::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancerFactory(), JobQueueGroup::singleton(), $services->getMainObjectStash(), new HashBagOStuff([ 'maxKeys'=> 100]), $services->getReadOnlyMode(), $services->getNamespaceInfo(), $services->getRevisionLookup(), $services->getHookContainer());$store->setStatsdDataFactory( $services->getStatsdDataFactory());if( $services->getMainConfig() ->get( 'ReadOnlyWatchedItemStore')) { $store=new NoWriteWatchedItemStore( $store);} return $store;}, 'WatchlistNotificationManager'=> function(MediaWikiServices $services) :WatchlistNotificationManager { return new WatchlistNotificationManager(new ServiceOptions(WatchlistNotificationManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getHookContainer(), $services->getPermissionManager(), $services->getReadOnlyMode(), $services->getRevisionLookup(), $services->getTalkPageNotificationManager(), $services->getWatchedItemStore());}, 'WikiRevisionOldRevisionImporterNoUpdates'=> function(MediaWikiServices $services) :ImportableOldRevisionImporter { return new ImportableOldRevisionImporter(false, LoggerFactory::getInstance( 'OldRevisionImporter'), $services->getDBLoadBalancer(), $services->getRevisionStore(), $services->getSlotRoleRegistry());}, '_DefaultOptionsLookup'=> function(MediaWikiServices $services) :DefaultOptionsLookup { return new DefaultOptionsLookup(new ServiceOptions(DefaultOptionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), $services->getHookContainer());}, '_MediaWikiTitleCodec'=> function(MediaWikiServices $services) :MediaWikiTitleCodec { return new MediaWikiTitleCodec($services->getContentLanguage(), $services->getGenderCache(), $services->getMainConfig() ->get( 'LocalInterwikis'), $services->getInterwikiLookup(), $services->getNamespaceInfo());}, '_PageCommandFactory'=> function(MediaWikiServices $services) :PageCommandFactory { return new PageCommandFactory(new ServiceOptions(PageCommandFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancer(), $services->getNamespaceInfo(), $services->getWatchedItemStore(), $services->getPermissionManager(), $services->getRepoGroup(), $services->getContentHandlerFactory(), $services->getRevisionStore(), $services->getSpamChecker(), $services->getHookContainer());}, '_SqlBlobStore'=> function(MediaWikiServices $services) :SqlBlobStore { return $services->getBlobStoreFactory() ->newSqlBlobStore();},]
if(ini_get('mbstring.func_overload')) if(!defined('MW_ENTRY_POINT'))
Pre-config setup: Before loading LocalSettings.php.
This class handles the logic for the actor table migration and should always be used in lieu of direc...
Class representing a cache/ephemeral data store.
get( $key, $flags=0)
Get an item with the given key.
A factory for application metric data.
Factory class to create Config objects.
Support for detecting/validating DjVu image files and getting some basic file metadata (resolution et...
A BagOStuff object with no objects in it.
Factory class for spawning EventRelayer objects using configuration.
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.
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Cache for article titles (prefixed DB keys) and ids linked from one source.
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)
static getLBFactoryClass(array $config)
Decide which LBFactory class to use.
static applyDefaultConfig(array $lbConf, ServiceOptions $options, ConfiguredReadOnlyMode $readOnlyMode, BagOStuff $srvCache, BagOStuff $mainStash, WANObjectCache $wanCache)
A factory that stores information about MagicWords, and creates them on demand with caching.
Service to check if text (either content or a summary) qualifies as spam.
Common factory to construct page handling classes.
A SlotRoleHandler for the main slot.
Factory for handling the special page list and generating SpecialPage objects.
Class for managing stashed edits used by the page updater classes.
Manages user talk page notifications.
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.
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.
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
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.
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.
static newFromIdentity(UserIdentity $identity)
Returns a User object corresponding to the given UserIdentity.
Virtual HTTP service client loosely styled after a Virtual File System.
Multi-datacenter aware caching interface.
static newEmpty()
Get an instance that wraps EmptyBagOStuff.
get( $key, &$curTTL=null, array $checkKeys=[], &$info=null)
Fetch the value of a key from cache.
Storage layer class for WatchedItems.
setStatsdDataFactory(StatsdDataFactoryInterface $stats)
Helper tools for dealing with other locally-hosted wikis.
static getWikiIdFromDbDomain( $domain)
Get the wiki ID of a database domain.
static getCurrentWikiDbDomain()
Interface for configuration instances.
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
A title parser service for MediaWiki.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
if(!is_readable( $file)) $ext