2020-01-15 16:08:53 +00:00
|
|
|
<?php
|
|
|
|
|
2020-09-20 22:31:41 +00:00
|
|
|
use MediaWiki\Config\ServiceOptions;
|
2020-09-18 14:49:13 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\AbuseFilterPermissionManager as PermManager;
|
2020-10-24 11:58:46 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\AbuseLogger;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\AbuseLoggerFactory;
|
2020-10-21 14:18:08 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\BlockAutopromoteStore;
|
2020-10-16 22:29:41 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\CentralDBManager;
|
2020-11-26 15:23:22 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\ChangeTags\ChangeTagger;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\ChangeTags\ChangeTagsManager;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\ChangeTags\ChangeTagValidator;
|
2020-12-18 14:05:33 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Consequences\ConsequencesExecutor;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\Consequences\ConsequencesExecutorFactory as ConsExecutorFactory;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\Consequences\ConsequencesFactory;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\Consequences\ConsequencesLookup;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\Consequences\ConsequencesRegistry;
|
2020-11-10 12:58:11 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\EchoNotifier;
|
2021-02-01 15:47:46 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\EditBox\EditBoxBuilderFactory;
|
2021-01-05 13:33:45 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\EditRevUpdater;
|
2021-02-10 13:13:03 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\EmergencyCache;
|
2020-11-07 11:40:26 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\FilterCompare;
|
2020-10-15 22:00:32 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\FilterImporter;
|
2020-09-20 11:30:59 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\FilterLookup;
|
2020-09-20 22:31:41 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\FilterProfiler;
|
2021-01-06 15:40:23 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\FilterRunner;
|
2020-11-27 14:49:41 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\FilterRunnerFactory;
|
2020-09-19 22:16:35 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\FilterStore;
|
2020-10-25 15:30:43 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\FilterUser;
|
2020-10-10 17:20:21 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\FilterValidator;
|
2020-01-15 16:08:53 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Hooks\AbuseFilterHookRunner;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\KeywordsManager;
|
2021-09-01 11:53:38 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Parser\RuleCheckerFactory;
|
2020-10-02 15:08:48 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\SpecsFormatter;
|
2020-09-29 18:48:51 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\TextExtractor;
|
2021-01-03 13:10:20 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\VariableGenerator\VariableGeneratorFactory;
|
2021-01-02 13:41:31 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Variables\LazyVariableComputer;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\Variables\VariablesBlobStore;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\Variables\VariablesFormatter;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\Variables\VariablesManager;
|
2020-11-19 15:32:39 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Watcher\EmergencyWatcher;
|
2020-11-28 23:53:42 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Watcher\UpdateHitCountWatcher;
|
2020-09-20 22:31:41 +00:00
|
|
|
use MediaWiki\Logger\LoggerFactory;
|
2020-01-15 16:08:53 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
2020-10-11 21:17:41 +00:00
|
|
|
use MediaWiki\Session\SessionManager;
|
2021-09-01 18:29:19 +00:00
|
|
|
use Wikimedia\Equivset\Equivset;
|
2020-01-15 16:08:53 +00:00
|
|
|
|
2020-11-19 17:49:55 +00:00
|
|
|
// This file is actually covered by AbuseFilterServicesTest, but it's not possible to specify a path
|
|
|
|
// in @covers annotations (https://github.com/sebastianbergmann/phpunit/issues/3794)
|
|
|
|
// @codeCoverageIgnoreStart
|
|
|
|
|
2020-01-15 16:08:53 +00:00
|
|
|
return [
|
2021-04-30 18:54:17 +00:00
|
|
|
AbuseFilterHookRunner::SERVICE_NAME => static function ( MediaWikiServices $services ): AbuseFilterHookRunner {
|
2021-01-09 13:40:10 +00:00
|
|
|
return new AbuseFilterHookRunner( $services->getHookContainer() );
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
KeywordsManager::SERVICE_NAME => static function ( MediaWikiServices $services ): KeywordsManager {
|
2021-01-09 13:40:10 +00:00
|
|
|
return new KeywordsManager( $services->get( AbuseFilterHookRunner::SERVICE_NAME ) );
|
2020-01-15 16:08:53 +00:00
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
FilterProfiler::SERVICE_NAME => static function ( MediaWikiServices $services ): FilterProfiler {
|
2020-09-20 22:31:41 +00:00
|
|
|
return new FilterProfiler(
|
|
|
|
$services->getMainObjectStash(),
|
|
|
|
new ServiceOptions(
|
|
|
|
FilterProfiler::CONSTRUCTOR_OPTIONS,
|
|
|
|
$services->getMainConfig()
|
|
|
|
),
|
|
|
|
WikiMap::getCurrentWikiDbDomain()->getId(),
|
|
|
|
$services->getStatsdDataFactory(),
|
|
|
|
LoggerFactory::getInstance( 'AbuseFilter' )
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
PermManager::SERVICE_NAME => static function ( MediaWikiServices $services ): PermManager {
|
2020-09-18 14:49:13 +00:00
|
|
|
return new PermManager( $services->getPermissionManager() );
|
|
|
|
},
|
2021-07-21 18:51:12 +00:00
|
|
|
ChangeTagger::SERVICE_NAME => static function ( MediaWikiServices $services ): ChangeTagger {
|
2020-10-21 14:30:43 +00:00
|
|
|
return new ChangeTagger(
|
|
|
|
$services->getService( ChangeTagsManager::SERVICE_NAME )
|
|
|
|
);
|
2020-10-13 16:01:18 +00:00
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
ChangeTagsManager::SERVICE_NAME => static function ( MediaWikiServices $services ): ChangeTagsManager {
|
2020-10-14 14:21:48 +00:00
|
|
|
return new ChangeTagsManager(
|
2020-10-16 22:29:41 +00:00
|
|
|
$services->getDBLoadBalancer(),
|
2020-10-14 14:21:48 +00:00
|
|
|
$services->getMainWANObjectCache(),
|
2020-10-16 22:29:41 +00:00
|
|
|
$services->get( CentralDBManager::SERVICE_NAME )
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
ChangeTagValidator::SERVICE_NAME => static function ( MediaWikiServices $services ): ChangeTagValidator {
|
2020-11-06 12:13:02 +00:00
|
|
|
return new ChangeTagValidator(
|
|
|
|
$services->getService( ChangeTagsManager::SERVICE_NAME )
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
CentralDBManager::SERVICE_NAME => static function ( MediaWikiServices $services ): CentralDBManager {
|
2020-10-16 22:29:41 +00:00
|
|
|
return new CentralDBManager(
|
|
|
|
$services->getDBLoadBalancerFactory(),
|
2020-09-20 11:30:59 +00:00
|
|
|
$services->getMainConfig()->get( 'AbuseFilterCentralDB' ),
|
|
|
|
$services->getMainConfig()->get( 'AbuseFilterIsCentral' )
|
2020-10-14 14:21:48 +00:00
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
BlockAutopromoteStore::SERVICE_NAME => static function ( MediaWikiServices $services ): BlockAutopromoteStore {
|
2020-10-21 14:18:08 +00:00
|
|
|
return new BlockAutopromoteStore(
|
2022-01-19 17:46:17 +00:00
|
|
|
$services->getMainObjectStash(),
|
2020-10-25 15:30:43 +00:00
|
|
|
LoggerFactory::getInstance( 'AbuseFilter' ),
|
|
|
|
$services->get( FilterUser::SERVICE_NAME )
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
FilterUser::SERVICE_NAME => static function ( MediaWikiServices $services ): FilterUser {
|
2020-10-25 15:30:43 +00:00
|
|
|
return new FilterUser(
|
|
|
|
// TODO We need a proper MessageLocalizer, see T247127
|
|
|
|
RequestContext::getMain(),
|
|
|
|
$services->getUserGroupManager(),
|
2020-10-21 14:18:08 +00:00
|
|
|
LoggerFactory::getInstance( 'AbuseFilter' )
|
|
|
|
);
|
|
|
|
},
|
2021-09-01 11:53:38 +00:00
|
|
|
RuleCheckerFactory::SERVICE_NAME => static function ( MediaWikiServices $services ): RuleCheckerFactory {
|
|
|
|
return new RuleCheckerFactory(
|
2019-12-16 16:19:48 +00:00
|
|
|
$services->getContentLanguage(),
|
|
|
|
// We could use $services here, but we need the fallback
|
|
|
|
ObjectCache::getLocalServerInstance( 'hash' ),
|
|
|
|
LoggerFactory::getInstance( 'AbuseFilter' ),
|
|
|
|
$services->getService( KeywordsManager::SERVICE_NAME ),
|
2020-10-18 22:25:05 +00:00
|
|
|
$services->get( VariablesManager::SERVICE_NAME ),
|
2021-09-01 11:18:23 +00:00
|
|
|
$services->getStatsdDataFactory(),
|
2021-09-01 18:29:19 +00:00
|
|
|
new Equivset(),
|
2021-01-01 16:07:14 +00:00
|
|
|
$services->getMainConfig()->get( 'AbuseFilterConditionLimit' )
|
2019-12-16 16:19:48 +00:00
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
FilterLookup::SERVICE_NAME => static function ( MediaWikiServices $services ): FilterLookup {
|
2020-09-20 11:30:59 +00:00
|
|
|
return new FilterLookup(
|
|
|
|
$services->getDBLoadBalancer(),
|
|
|
|
$services->getMainWANObjectCache(),
|
|
|
|
$services->get( CentralDBManager::SERVICE_NAME )
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
EmergencyCache::SERVICE_NAME => static function ( MediaWikiServices $services ): EmergencyCache {
|
2021-02-10 13:13:03 +00:00
|
|
|
return new EmergencyCache(
|
|
|
|
$services->getMainObjectStash(),
|
|
|
|
$services->getMainConfig()->get( 'AbuseFilterEmergencyDisableAge' )
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
EmergencyWatcher::SERVICE_NAME => static function ( MediaWikiServices $services ): EmergencyWatcher {
|
2020-09-19 09:45:25 +00:00
|
|
|
return new EmergencyWatcher(
|
2021-02-10 13:13:03 +00:00
|
|
|
$services->getService( EmergencyCache::SERVICE_NAME ),
|
2020-09-19 09:45:25 +00:00
|
|
|
$services->getDBLoadBalancer(),
|
|
|
|
$services->getService( FilterLookup::SERVICE_NAME ),
|
2020-11-10 12:58:11 +00:00
|
|
|
$services->getService( EchoNotifier::SERVICE_NAME ),
|
2020-09-19 09:45:25 +00:00
|
|
|
new ServiceOptions(
|
|
|
|
EmergencyWatcher::CONSTRUCTOR_OPTIONS,
|
|
|
|
$services->getMainConfig()
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
EchoNotifier::SERVICE_NAME => static function ( MediaWikiServices $services ): EchoNotifier {
|
2020-11-10 12:58:11 +00:00
|
|
|
return new EchoNotifier(
|
|
|
|
$services->getService( FilterLookup::SERVICE_NAME ),
|
|
|
|
ExtensionRegistry::getInstance()->isLoaded( 'Echo' )
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
FilterValidator::SERVICE_NAME => static function ( MediaWikiServices $services ): FilterValidator {
|
2020-10-10 17:20:21 +00:00
|
|
|
return new FilterValidator(
|
2020-11-06 12:13:02 +00:00
|
|
|
$services->get( ChangeTagValidator::SERVICE_NAME ),
|
2021-09-01 11:53:38 +00:00
|
|
|
$services->get( RuleCheckerFactory::SERVICE_NAME ),
|
2020-10-10 17:20:21 +00:00
|
|
|
$services->get( PermManager::SERVICE_NAME ),
|
2021-02-26 16:47:50 +00:00
|
|
|
new ServiceOptions(
|
|
|
|
FilterValidator::CONSTRUCTOR_OPTIONS,
|
|
|
|
$services->getMainConfig()
|
|
|
|
)
|
2020-10-10 17:20:21 +00:00
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
FilterCompare::SERVICE_NAME => static function ( MediaWikiServices $services ): FilterCompare {
|
2020-11-07 11:40:26 +00:00
|
|
|
return new FilterCompare(
|
2020-11-29 23:10:14 +00:00
|
|
|
$services->get( ConsequencesRegistry::SERVICE_NAME )
|
2020-11-07 11:40:26 +00:00
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
FilterImporter::SERVICE_NAME => static function ( MediaWikiServices $services ): FilterImporter {
|
2020-10-15 22:00:32 +00:00
|
|
|
return new FilterImporter(
|
|
|
|
new ServiceOptions(
|
|
|
|
FilterImporter::CONSTRUCTOR_OPTIONS,
|
|
|
|
$services->getMainConfig()
|
2020-11-29 23:10:14 +00:00
|
|
|
),
|
|
|
|
$services->get( ConsequencesRegistry::SERVICE_NAME )
|
2020-10-15 22:00:32 +00:00
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
FilterStore::SERVICE_NAME => static function ( MediaWikiServices $services ): FilterStore {
|
2020-09-19 22:16:35 +00:00
|
|
|
return new FilterStore(
|
2020-11-29 23:10:14 +00:00
|
|
|
$services->get( ConsequencesRegistry::SERVICE_NAME ),
|
2020-09-19 22:16:35 +00:00
|
|
|
$services->getDBLoadBalancer(),
|
|
|
|
$services->get( FilterProfiler::SERVICE_NAME ),
|
|
|
|
$services->get( FilterLookup::SERVICE_NAME ),
|
|
|
|
$services->get( ChangeTagsManager::SERVICE_NAME ),
|
|
|
|
$services->get( FilterValidator::SERVICE_NAME ),
|
2021-02-10 13:13:03 +00:00
|
|
|
$services->get( FilterCompare::SERVICE_NAME ),
|
|
|
|
$services->get( EmergencyCache::SERVICE_NAME )
|
2020-09-19 22:16:35 +00:00
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
ConsequencesFactory::SERVICE_NAME => static function ( MediaWikiServices $services ): ConsequencesFactory {
|
2020-10-11 21:17:41 +00:00
|
|
|
return new ConsequencesFactory(
|
|
|
|
new ServiceOptions(
|
|
|
|
ConsequencesFactory::CONSTRUCTOR_OPTIONS,
|
|
|
|
$services->getMainConfig()
|
|
|
|
),
|
|
|
|
LoggerFactory::getInstance( 'AbuseFilter' ),
|
|
|
|
$services->getBlockUserFactory(),
|
2020-11-29 15:18:32 +00:00
|
|
|
$services->getDatabaseBlockStore(),
|
2020-10-11 21:17:41 +00:00
|
|
|
$services->getUserGroupManager(),
|
|
|
|
$services->getMainObjectStash(),
|
|
|
|
$services->get( ChangeTagger::SERVICE_NAME ),
|
|
|
|
$services->get( BlockAutopromoteStore::SERVICE_NAME ),
|
|
|
|
$services->get( FilterUser::SERVICE_NAME ),
|
|
|
|
SessionManager::getGlobalSession(),
|
2021-01-09 23:26:29 +00:00
|
|
|
// TODO: Use a proper MessageLocalizer once available (T247127)
|
|
|
|
RequestContext::getMain(),
|
|
|
|
$services->getUserEditTracker(),
|
|
|
|
$services->getUserFactory(),
|
2020-10-11 21:17:41 +00:00
|
|
|
RequestContext::getMain()->getRequest()->getIP()
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
EditBoxBuilderFactory::SERVICE_NAME => static function ( MediaWikiServices $services ): EditBoxBuilderFactory {
|
2020-11-24 12:16:41 +00:00
|
|
|
return new EditBoxBuilderFactory(
|
|
|
|
$services->get( PermManager::SERVICE_NAME ),
|
|
|
|
$services->get( KeywordsManager::SERVICE_NAME ),
|
|
|
|
ExtensionRegistry::getInstance()->isLoaded( 'CodeEditor' )
|
|
|
|
);
|
|
|
|
},
|
2021-07-21 18:51:12 +00:00
|
|
|
ConsequencesLookup::SERVICE_NAME => static function ( MediaWikiServices $services ): ConsequencesLookup {
|
2020-10-17 11:50:21 +00:00
|
|
|
return new ConsequencesLookup(
|
|
|
|
$services->getDBLoadBalancer(),
|
|
|
|
$services->get( CentralDBManager::SERVICE_NAME ),
|
2020-11-29 22:55:34 +00:00
|
|
|
$services->get( ConsequencesRegistry::SERVICE_NAME ),
|
2020-10-17 11:50:21 +00:00
|
|
|
LoggerFactory::getInstance( 'AbuseFilter' )
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
ConsequencesRegistry::SERVICE_NAME => static function ( MediaWikiServices $services ): ConsequencesRegistry {
|
2020-11-29 22:55:34 +00:00
|
|
|
return new ConsequencesRegistry(
|
2021-01-09 13:40:10 +00:00
|
|
|
$services->get( AbuseFilterHookRunner::SERVICE_NAME ),
|
2020-12-04 16:21:21 +00:00
|
|
|
$services->getMainConfig()->get( 'AbuseFilterActions' )
|
2020-11-29 22:55:34 +00:00
|
|
|
);
|
|
|
|
},
|
2021-07-21 18:51:12 +00:00
|
|
|
AbuseLoggerFactory::SERVICE_NAME => static function ( MediaWikiServices $services ): AbuseLoggerFactory {
|
2020-10-24 11:58:46 +00:00
|
|
|
return new AbuseLoggerFactory(
|
|
|
|
$services->get( CentralDBManager::SERVICE_NAME ),
|
|
|
|
$services->get( FilterLookup::SERVICE_NAME ),
|
2020-09-29 14:52:05 +00:00
|
|
|
$services->get( VariablesBlobStore::SERVICE_NAME ),
|
2020-10-18 22:25:05 +00:00
|
|
|
$services->get( VariablesManager::SERVICE_NAME ),
|
2021-01-05 13:33:45 +00:00
|
|
|
$services->get( EditRevUpdater::SERVICE_NAME ),
|
2020-10-24 11:58:46 +00:00
|
|
|
$services->getDBLoadBalancer(),
|
|
|
|
new ServiceOptions(
|
|
|
|
AbuseLogger::CONSTRUCTOR_OPTIONS,
|
|
|
|
$services->getMainConfig()
|
|
|
|
),
|
|
|
|
WikiMap::getCurrentWikiDbDomain()->getId(),
|
|
|
|
RequestContext::getMain()->getRequest()->getIP()
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
UpdateHitCountWatcher::SERVICE_NAME => static function ( MediaWikiServices $services ): UpdateHitCountWatcher {
|
2020-11-28 23:53:42 +00:00
|
|
|
return new UpdateHitCountWatcher(
|
|
|
|
$services->getDBLoadBalancer(),
|
|
|
|
$services->get( CentralDBManager::SERVICE_NAME )
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
VariablesBlobStore::SERVICE_NAME => static function ( MediaWikiServices $services ): VariablesBlobStore {
|
2020-09-29 14:52:05 +00:00
|
|
|
return new VariablesBlobStore(
|
2020-10-18 22:25:05 +00:00
|
|
|
$services->get( VariablesManager::SERVICE_NAME ),
|
2020-09-29 14:52:05 +00:00
|
|
|
$services->getBlobStoreFactory(),
|
|
|
|
$services->getBlobStore(),
|
|
|
|
$services->getMainConfig()->get( 'AbuseFilterCentralDB' )
|
|
|
|
);
|
|
|
|
},
|
2021-07-21 18:51:12 +00:00
|
|
|
ConsExecutorFactory::SERVICE_NAME => static function ( MediaWikiServices $services ): ConsExecutorFactory {
|
2020-10-16 22:10:37 +00:00
|
|
|
return new ConsExecutorFactory(
|
|
|
|
$services->get( ConsequencesLookup::SERVICE_NAME ),
|
|
|
|
$services->get( ConsequencesFactory::SERVICE_NAME ),
|
|
|
|
$services->get( ConsequencesRegistry::SERVICE_NAME ),
|
|
|
|
$services->get( FilterLookup::SERVICE_NAME ),
|
|
|
|
LoggerFactory::getInstance( 'AbuseFilter' ),
|
|
|
|
new ServiceOptions(
|
|
|
|
ConsequencesExecutor::CONSTRUCTOR_OPTIONS,
|
|
|
|
$services->getMainConfig()
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
2021-07-21 18:51:12 +00:00
|
|
|
FilterRunnerFactory::SERVICE_NAME => static function ( MediaWikiServices $services ): FilterRunnerFactory {
|
2020-11-27 14:49:41 +00:00
|
|
|
return new FilterRunnerFactory(
|
2021-01-09 13:40:10 +00:00
|
|
|
$services->get( AbuseFilterHookRunner::SERVICE_NAME ),
|
2020-11-27 14:49:41 +00:00
|
|
|
$services->get( FilterProfiler::SERVICE_NAME ),
|
|
|
|
$services->get( ChangeTagger::SERVICE_NAME ),
|
|
|
|
$services->get( FilterLookup::SERVICE_NAME ),
|
2021-09-01 11:53:38 +00:00
|
|
|
$services->get( RuleCheckerFactory::SERVICE_NAME ),
|
2021-09-01 18:29:19 +00:00
|
|
|
$services->get( ConsExecutorFactory::SERVICE_NAME ),
|
2020-11-27 14:49:41 +00:00
|
|
|
$services->get( AbuseLoggerFactory::SERVICE_NAME ),
|
2020-10-18 22:25:05 +00:00
|
|
|
$services->get( VariablesManager::SERVICE_NAME ),
|
2021-01-03 13:10:20 +00:00
|
|
|
$services->get( VariableGeneratorFactory::SERVICE_NAME ),
|
2021-02-10 13:13:03 +00:00
|
|
|
$services->get( EmergencyCache::SERVICE_NAME ),
|
2020-11-27 14:49:41 +00:00
|
|
|
$services->get( UpdateHitCountWatcher::SERVICE_NAME ),
|
|
|
|
$services->get( EmergencyWatcher::SERVICE_NAME ),
|
2020-12-21 14:51:31 +00:00
|
|
|
ObjectCache::getLocalClusterInstance(),
|
2020-11-27 14:49:41 +00:00
|
|
|
LoggerFactory::getInstance( 'AbuseFilter' ),
|
2020-12-21 14:51:31 +00:00
|
|
|
LoggerFactory::getInstance( 'StashEdit' ),
|
2020-11-27 14:49:41 +00:00
|
|
|
$services->getStatsdDataFactory(),
|
2021-01-06 15:40:23 +00:00
|
|
|
new ServiceOptions(
|
|
|
|
FilterRunner::CONSTRUCTOR_OPTIONS,
|
|
|
|
$services->getMainConfig()
|
|
|
|
)
|
2020-11-27 14:49:41 +00:00
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
VariablesFormatter::SERVICE_NAME => static function ( MediaWikiServices $services ): VariablesFormatter {
|
2020-12-31 13:29:00 +00:00
|
|
|
return new VariablesFormatter(
|
|
|
|
$services->get( KeywordsManager::SERVICE_NAME ),
|
2020-10-18 22:25:05 +00:00
|
|
|
$services->get( VariablesManager::SERVICE_NAME ),
|
2020-12-31 13:29:00 +00:00
|
|
|
// TODO: Use a proper MessageLocalizer once available (T247127)
|
|
|
|
RequestContext::getMain()
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
SpecsFormatter::SERVICE_NAME => static function ( MediaWikiServices $services ): SpecsFormatter {
|
2020-10-02 15:08:48 +00:00
|
|
|
return new SpecsFormatter(
|
|
|
|
// TODO: Use a proper MessageLocalizer once available (T247127)
|
|
|
|
RequestContext::getMain()
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
LazyVariableComputer::SERVICE_NAME => static function ( MediaWikiServices $services ): LazyVariableComputer {
|
2020-09-25 22:32:01 +00:00
|
|
|
return new LazyVariableComputer(
|
2020-09-29 18:48:51 +00:00
|
|
|
$services->get( TextExtractor::SERVICE_NAME ),
|
2021-01-09 13:40:10 +00:00
|
|
|
$services->get( AbuseFilterHookRunner::SERVICE_NAME ),
|
2020-09-25 22:32:01 +00:00
|
|
|
LoggerFactory::getInstance( 'AbuseFilter' ),
|
|
|
|
$services->getDBLoadBalancer(),
|
|
|
|
$services->getMainWANObjectCache(),
|
|
|
|
$services->getRevisionLookup(),
|
|
|
|
$services->getRevisionStore(),
|
|
|
|
$services->getContentLanguage(),
|
|
|
|
$services->getParser(),
|
2021-03-09 17:56:04 +00:00
|
|
|
$services->getUserEditTracker(),
|
|
|
|
$services->getUserGroupManager(),
|
|
|
|
$services->getPermissionManager(),
|
2020-09-25 22:32:01 +00:00
|
|
|
WikiMap::getCurrentWikiDbDomain()->getId()
|
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
TextExtractor::SERVICE_NAME => static function ( MediaWikiServices $services ): TextExtractor {
|
2021-01-09 13:40:10 +00:00
|
|
|
return new TextExtractor( $services->get( AbuseFilterHookRunner::SERVICE_NAME ) );
|
2020-10-18 22:25:05 +00:00
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
VariablesManager::SERVICE_NAME => static function ( MediaWikiServices $services ): VariablesManager {
|
2020-10-18 22:25:05 +00:00
|
|
|
return new VariablesManager(
|
|
|
|
$services->get( KeywordsManager::SERVICE_NAME ),
|
2021-09-01 11:18:23 +00:00
|
|
|
$services->get( LazyVariableComputer::SERVICE_NAME )
|
2020-10-18 22:25:05 +00:00
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
VariableGeneratorFactory::SERVICE_NAME => static function (
|
|
|
|
MediaWikiServices $services
|
|
|
|
): VariableGeneratorFactory {
|
2021-01-03 13:10:20 +00:00
|
|
|
return new VariableGeneratorFactory(
|
2021-01-09 13:40:10 +00:00
|
|
|
$services->get( AbuseFilterHookRunner::SERVICE_NAME ),
|
2021-01-03 13:10:20 +00:00
|
|
|
$services->get( TextExtractor::SERVICE_NAME ),
|
|
|
|
$services->getMimeAnalyzer(),
|
2021-08-29 09:08:24 +00:00
|
|
|
$services->getRepoGroup(),
|
|
|
|
$services->getWikiPageFactory()
|
2021-01-03 13:10:20 +00:00
|
|
|
);
|
|
|
|
},
|
2021-04-30 18:54:17 +00:00
|
|
|
EditRevUpdater::SERVICE_NAME => static function ( MediaWikiServices $services ): EditRevUpdater {
|
2021-01-05 13:33:45 +00:00
|
|
|
return new EditRevUpdater(
|
|
|
|
$services->get( CentralDBManager::SERVICE_NAME ),
|
|
|
|
$services->getRevisionLookup(),
|
|
|
|
$services->getDBLoadBalancer(),
|
|
|
|
WikiMap::getCurrentWikiDbDomain()->getId()
|
|
|
|
);
|
|
|
|
},
|
2020-01-15 16:08:53 +00:00
|
|
|
];
|
2020-11-19 17:49:55 +00:00
|
|
|
|
|
|
|
// @codeCoverageIgnoreEnd
|