mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-14 17:55:00 +00:00
1445d5962a
This service is responsible for the blockautopromote feature: (un)block autopromotion and check status. The patch mostly moves code from static methods to the new class and relaxes type hints (e.g. from User to UserIdentity). Change-Id: I79a72377881cf06717931cd09af12f3b8e5f3e3f
57 lines
2 KiB
PHP
57 lines
2 KiB
PHP
<?php
|
|
|
|
use MediaWiki\Config\ServiceOptions;
|
|
use MediaWiki\Extension\AbuseFilter\AbuseFilterPermissionManager as PermManager;
|
|
use MediaWiki\Extension\AbuseFilter\BlockAutopromoteStore;
|
|
use MediaWiki\Extension\AbuseFilter\ChangeTagger;
|
|
use MediaWiki\Extension\AbuseFilter\ChangeTagsManager;
|
|
use MediaWiki\Extension\AbuseFilter\FilterProfiler;
|
|
use MediaWiki\Extension\AbuseFilter\Hooks\AbuseFilterHookRunner;
|
|
use MediaWiki\Extension\AbuseFilter\KeywordsManager;
|
|
use MediaWiki\Logger\LoggerFactory;
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
return [
|
|
KeywordsManager::SERVICE_NAME => function ( MediaWikiServices $services ): KeywordsManager {
|
|
return new KeywordsManager(
|
|
new AbuseFilterHookRunner( $services->getHookContainer() )
|
|
);
|
|
},
|
|
FilterProfiler::SERVICE_NAME => function ( MediaWikiServices $services ): FilterProfiler {
|
|
return new FilterProfiler(
|
|
$services->getMainObjectStash(),
|
|
new ServiceOptions(
|
|
FilterProfiler::CONSTRUCTOR_OPTIONS,
|
|
$services->getMainConfig()
|
|
),
|
|
WikiMap::getCurrentWikiDbDomain()->getId(),
|
|
$services->getStatsdDataFactory(),
|
|
LoggerFactory::getInstance( 'AbuseFilter' )
|
|
);
|
|
},
|
|
PermManager::SERVICE_NAME => function ( MediaWikiServices $services ): PermManager {
|
|
return new PermManager( $services->getPermissionManager() );
|
|
},
|
|
ChangeTagger::SERVICE_NAME => function ( MediaWikiServices $services ) : ChangeTagger {
|
|
return new ChangeTagger(
|
|
$services->getService( ChangeTagsManager::SERVICE_NAME )
|
|
);
|
|
},
|
|
ChangeTagsManager::SERVICE_NAME => function ( MediaWikiServices $services ): ChangeTagsManager {
|
|
return new ChangeTagsManager(
|
|
$services->getDBLoadBalancerFactory(),
|
|
$services->getMainWANObjectCache(),
|
|
new ServiceOptions(
|
|
ChangeTagsManager::CONSTRUCTOR_OPTIONS,
|
|
$services->getMainConfig()
|
|
)
|
|
);
|
|
},
|
|
BlockAutopromoteStore::SERVICE_NAME => function ( MediaWikiServices $services ): BlockAutopromoteStore {
|
|
return new BlockAutopromoteStore(
|
|
ObjectCache::getInstance( 'db-replicated' ),
|
|
LoggerFactory::getInstance( 'AbuseFilter' )
|
|
);
|
|
},
|
|
];
|