2012-04-14 10:10:35 +00:00
|
|
|
<?php
|
2016-12-04 15:13:16 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
2012-04-14 10:10:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This class formats abuse log notifications.
|
2016-12-21 14:56:32 +00:00
|
|
|
*
|
|
|
|
* Uses logentry-abusefilter-hit
|
2012-04-14 10:10:35 +00:00
|
|
|
*/
|
|
|
|
class AbuseLogHitFormatter extends LogFormatter {
|
|
|
|
|
2012-06-21 13:31:09 +00:00
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
2012-04-14 10:10:35 +00:00
|
|
|
protected function getMessageParameters() {
|
|
|
|
$entry = $this->entry->getParameters();
|
2016-12-04 15:13:16 +00:00
|
|
|
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
|
2012-04-14 10:10:35 +00:00
|
|
|
$params = parent::getMessageParameters();
|
|
|
|
|
|
|
|
$filter_title = SpecialPage::getTitleFor( 'AbuseFilter', $entry['filter'] );
|
|
|
|
$filter_caption = $this->msg( 'abusefilter-log-detailedentry-local' )->params( $entry['filter'] );
|
|
|
|
$log_title = SpecialPage::getTitleFor( 'AbuseLog', $entry['log'] );
|
2015-09-28 18:03:35 +00:00
|
|
|
$log_caption = $this->msg( 'abusefilter-log-detailslink' );
|
2012-04-14 10:10:35 +00:00
|
|
|
|
|
|
|
$params[4] = $entry['action'];
|
|
|
|
|
|
|
|
if ( $this->plaintext ) {
|
|
|
|
$params[3] = '[[' . $filter_title->getPrefixedText() . '|' . $filter_caption . ']]';
|
|
|
|
$params[8] = '[[' . $log_title->getPrefixedText() . '|' . $log_caption . ']]';
|
|
|
|
} else {
|
2016-12-04 15:13:16 +00:00
|
|
|
$params[3] = Message::rawParam( $linkRenderer->makeLink(
|
2012-04-14 10:10:35 +00:00
|
|
|
$filter_title,
|
2016-12-04 15:13:16 +00:00
|
|
|
$filter_caption
|
2012-04-14 10:10:35 +00:00
|
|
|
) );
|
2016-12-04 15:13:16 +00:00
|
|
|
$params[8] = Message::rawParam( $linkRenderer->makeLink(
|
2012-04-14 10:10:35 +00:00
|
|
|
$log_title,
|
2016-12-04 15:13:16 +00:00
|
|
|
$log_caption
|
2012-04-14 10:10:35 +00:00
|
|
|
) );
|
|
|
|
}
|
|
|
|
|
|
|
|
$actions_taken = $entry['actions'];
|
|
|
|
if ( !strlen( trim( $actions_taken ) ) ) {
|
|
|
|
$actions_taken = $this->msg( 'abusefilter-log-noactions' );
|
|
|
|
} else {
|
|
|
|
$actions = explode( ',', $actions_taken );
|
2017-06-15 14:23:34 +00:00
|
|
|
$displayActions = [];
|
2012-04-14 10:10:35 +00:00
|
|
|
|
|
|
|
foreach ( $actions as $action ) {
|
|
|
|
$displayActions[] = AbuseFilter::getActionDisplay( $action );
|
|
|
|
}
|
|
|
|
$actions_taken = $this->context->getLanguage()->commaList( $displayActions );
|
|
|
|
}
|
|
|
|
$params[5] = $actions_taken;
|
|
|
|
|
|
|
|
// Bad things happen if the numbers are not in correct order
|
2015-09-28 18:03:35 +00:00
|
|
|
ksort( $params );
|
|
|
|
|
2012-04-14 10:10:35 +00:00
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
}
|