mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-11 16:28:21 +00:00
Migrate change tags hooks to DI
Bug: T261067 Change-Id: I7b95cd19ab0ae04820e8dcb3481d29a2f9e7a0ca
This commit is contained in:
parent
85e000c6ed
commit
2ee3a0d247
|
@ -277,6 +277,10 @@
|
|||
"ToolLinks": {
|
||||
"class": "MediaWiki\\Extension\\AbuseFilter\\Hooks\\Handlers\\ToolLinksHandler",
|
||||
"services": [ "AbuseFilterPermissionManager" ]
|
||||
},
|
||||
"ChangeTags": {
|
||||
"class": "MediaWiki\\Extension\\AbuseFilter\\Hooks\\Handlers\\ChangeTagsHandler",
|
||||
"services": [ "AbuseFilterChangeTagsManager" ]
|
||||
}
|
||||
},
|
||||
"Hooks": {
|
||||
|
@ -285,8 +289,8 @@
|
|||
"TitleMove": "AbuseFilterHooks::onTitleMove",
|
||||
"ArticleDelete": "AbuseFilterHooks::onArticleDelete",
|
||||
"RecentChange_save": "AbuseFilterHooks::onRecentChangeSave",
|
||||
"ListDefinedTags": "AbuseFilterHooks::onListDefinedTags",
|
||||
"ChangeTagsListActive": "AbuseFilterHooks::onChangeTagsListActive",
|
||||
"ListDefinedTags": "ChangeTags",
|
||||
"ChangeTagsListActive": "ChangeTags",
|
||||
"LoadExtensionSchemaUpdates": "AbuseFilterHooks::onLoadExtensionSchemaUpdates",
|
||||
"ContributionsToolLinks": "ToolLinks",
|
||||
"HistoryPageToolLinks": "ToolLinks",
|
||||
|
|
|
@ -335,30 +335,6 @@ class AbuseFilterHooks {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] &$tags
|
||||
*/
|
||||
public static function onListDefinedTags( array &$tags ) {
|
||||
$manager = AbuseFilterServices::getChangeTagsManager();
|
||||
$tags = array_merge(
|
||||
$tags,
|
||||
$manager->getTagsDefinedByFilters(),
|
||||
[ $manager->getCondsLimitTag() ]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] &$tags
|
||||
*/
|
||||
public static function onChangeTagsListActive( array &$tags ) {
|
||||
$manager = AbuseFilterServices::getChangeTagsManager();
|
||||
$tags = array_merge(
|
||||
$tags,
|
||||
$manager->getTagsDefinedByActiveFilters(),
|
||||
[ $manager->getCondsLimitTag() ]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DatabaseUpdater $updater
|
||||
* @throws MWException
|
||||
|
|
43
includes/Hooks/Handlers/ChangeTagsHandler.php
Normal file
43
includes/Hooks/Handlers/ChangeTagsHandler.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace MediaWiki\Extension\AbuseFilter\Hooks\Handlers;
|
||||
|
||||
use MediaWiki\Extension\AbuseFilter\ChangeTagsManager;
|
||||
|
||||
class ChangeTagsHandler implements
|
||||
\MediaWiki\ChangeTags\Hook\ListDefinedTagsHook,
|
||||
\MediaWiki\ChangeTags\Hook\ChangeTagsListActiveHook
|
||||
{
|
||||
|
||||
/** @var ChangeTagsManager */
|
||||
private $changeTagsManager;
|
||||
|
||||
/**
|
||||
* @param ChangeTagsManager $changeTagsManager
|
||||
*/
|
||||
public function __construct( ChangeTagsManager $changeTagsManager ) {
|
||||
$this->changeTagsManager = $changeTagsManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] &$tags
|
||||
*/
|
||||
public function onListDefinedTags( &$tags ) {
|
||||
$tags = array_merge(
|
||||
$tags,
|
||||
$this->changeTagsManager->getTagsDefinedByFilters(),
|
||||
[ $this->changeTagsManager->getCondsLimitTag() ]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] &$tags
|
||||
*/
|
||||
public function onChangeTagsListActive( &$tags ) {
|
||||
$tags = array_merge(
|
||||
$tags,
|
||||
$this->changeTagsManager->getTagsDefinedByActiveFilters(),
|
||||
[ $this->changeTagsManager->getCondsLimitTag() ]
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue