mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
logging: Inject services into AbuseLogHitFormatter
Bug: T356468 Change-Id: I42023b7dcdaf80aeb3367d82068e1de47f8ae424
This commit is contained in:
parent
09d6a0cc79
commit
13cf3eb20a
|
@ -115,7 +115,12 @@
|
|||
"abusefilter": "abusefilter-log-header"
|
||||
},
|
||||
"LogActionsHandlers": {
|
||||
"abusefilter/hit": "MediaWiki\\Extension\\AbuseFilter\\LogFormatter\\AbuseLogHitFormatter",
|
||||
"abusefilter/hit": {
|
||||
"class": "MediaWiki\\Extension\\AbuseFilter\\LogFormatter\\AbuseLogHitFormatter",
|
||||
"services": [
|
||||
"AbuseFilterSpecsFormatter"
|
||||
]
|
||||
},
|
||||
"abusefilter/modify": "MediaWiki\\Extension\\AbuseFilter\\LogFormatter\\AbuseFilterModifyLogFormatter",
|
||||
"abusefilter/create": "MediaWiki\\Extension\\AbuseFilter\\LogFormatter\\AbuseFilterModifyLogFormatter",
|
||||
"abusefilterblockeddomainhit/*": "MediaWiki\\Extension\\AbuseFilter\\LogFormatter\\AbuseFilterBlockedDomainHitLogFormatter",
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
namespace MediaWiki\Extension\AbuseFilter\LogFormatter;
|
||||
|
||||
use LogEntry;
|
||||
use LogFormatter;
|
||||
use MediaWiki\Extension\AbuseFilter\AbuseFilterServices;
|
||||
use MediaWiki\Extension\AbuseFilter\SpecsFormatter;
|
||||
use MediaWiki\SpecialPage\SpecialPage;
|
||||
use Message;
|
||||
|
||||
|
@ -14,6 +15,16 @@ use Message;
|
|||
*/
|
||||
class AbuseLogHitFormatter extends LogFormatter {
|
||||
|
||||
private SpecsFormatter $specsFormatter;
|
||||
|
||||
public function __construct(
|
||||
LogEntry $entry,
|
||||
SpecsFormatter $specsFormatter
|
||||
) {
|
||||
parent::__construct( $entry );
|
||||
$this->specsFormatter = $specsFormatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
@ -52,10 +63,9 @@ class AbuseLogHitFormatter extends LogFormatter {
|
|||
$actions = explode( ',', $actions_takenRaw );
|
||||
$displayActions = [];
|
||||
|
||||
$specsFormatter = AbuseFilterServices::getSpecsFormatter();
|
||||
$specsFormatter->setMessageLocalizer( $this->context );
|
||||
$this->specsFormatter->setMessageLocalizer( $this->context );
|
||||
foreach ( $actions as $action ) {
|
||||
$displayActions[] = $specsFormatter->getActionDisplay( $action );
|
||||
$displayActions[] = $this->specsFormatter->getActionDisplay( $action );
|
||||
}
|
||||
$actions_taken = $this->context->getLanguage()->commaList( $displayActions );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue