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-21 14:18:08 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\BlockAutopromoteStore;
|
2020-10-13 16:01:18 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\ChangeTagger;
|
2020-10-14 14:21:48 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\ChangeTagsManager;
|
2020-09-20 22:31:41 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\FilterProfiler;
|
2020-01-15 16:08:53 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Hooks\AbuseFilterHookRunner;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\KeywordsManager;
|
2020-09-20 22:31:41 +00:00
|
|
|
use MediaWiki\Logger\LoggerFactory;
|
2020-01-15 16:08:53 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
|
|
|
|
return [
|
|
|
|
KeywordsManager::SERVICE_NAME => function ( MediaWikiServices $services ): KeywordsManager {
|
|
|
|
return new KeywordsManager(
|
|
|
|
new AbuseFilterHookRunner( $services->getHookContainer() )
|
|
|
|
);
|
|
|
|
},
|
2020-09-20 22:31:41 +00:00
|
|
|
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' )
|
|
|
|
);
|
|
|
|
},
|
2020-09-18 14:49:13 +00:00
|
|
|
PermManager::SERVICE_NAME => function ( MediaWikiServices $services ): PermManager {
|
|
|
|
return new PermManager( $services->getPermissionManager() );
|
|
|
|
},
|
2020-10-13 16:01:18 +00:00
|
|
|
ChangeTagger::SERVICE_NAME => 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
|
|
|
},
|
2020-10-14 14:21:48 +00:00
|
|
|
ChangeTagsManager::SERVICE_NAME => function ( MediaWikiServices $services ): ChangeTagsManager {
|
|
|
|
return new ChangeTagsManager(
|
|
|
|
$services->getDBLoadBalancerFactory(),
|
|
|
|
$services->getMainWANObjectCache(),
|
|
|
|
new ServiceOptions(
|
|
|
|
ChangeTagsManager::CONSTRUCTOR_OPTIONS,
|
|
|
|
$services->getMainConfig()
|
|
|
|
)
|
|
|
|
);
|
|
|
|
},
|
2020-10-21 14:18:08 +00:00
|
|
|
BlockAutopromoteStore::SERVICE_NAME => function ( MediaWikiServices $services ): BlockAutopromoteStore {
|
|
|
|
return new BlockAutopromoteStore(
|
|
|
|
ObjectCache::getInstance( 'db-replicated' ),
|
|
|
|
LoggerFactory::getInstance( 'AbuseFilter' )
|
|
|
|
);
|
|
|
|
},
|
2020-01-15 16:08:53 +00:00
|
|
|
];
|