mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 13:46:48 +00:00
Migrate AbuseFilter suppress log
Also make entries in Special:Log/suppress filterable. Change-Id: Ic23e724997e4748c8d0da8138aa73d31b17b7064
This commit is contained in:
parent
a6c5aa8927
commit
10ad58a6f3
|
@ -67,15 +67,13 @@
|
|||
"LogHeaders": {
|
||||
"abusefilter": "abusefilter-log-header"
|
||||
},
|
||||
"LogActions": {
|
||||
"suppress/hide-afl": "abusefilter-logentry-suppress",
|
||||
"suppress/unhide-afl": "abusefilter-logentry-unsuppress"
|
||||
},
|
||||
"LogActionsHandlers": {
|
||||
"abusefilter/hit": "AbuseLogHitFormatter",
|
||||
"abusefilter/modify": "AbuseFilterModifyLogFormatter",
|
||||
"abusefilter/create": "AbuseFilterModifyLogFormatter",
|
||||
"abusefilterprivatedetails/access": "LogFormatter"
|
||||
"abusefilterprivatedetails/access": "LogFormatter",
|
||||
"suppress/hide-afl": "AbuseFilterSuppressLogFormatter",
|
||||
"suppress/unhide-afl": "AbuseFilterSuppressLogFormatter"
|
||||
},
|
||||
"ActionFilteredLogs": {
|
||||
"abusefilter": {
|
||||
|
@ -120,6 +118,7 @@
|
|||
"SpecialAbuseFilter": "includes/special/SpecialAbuseFilter.php",
|
||||
"AbuseLogHitFormatter": "includes/AbuseLogHitFormatter.php",
|
||||
"AbuseFilterModifyLogFormatter": "includes/AbuseFilterModifyLogFormatter.php",
|
||||
"AbuseFilterSuppressLogFormatter": "includes/AbuseFilterSuppressLogFormatter.php",
|
||||
"AbuseFilterViewList": "includes/Views/AbuseFilterViewList.php",
|
||||
"AbuseFilterPager": "includes/pagers/AbuseFilterPager.php",
|
||||
"GlobalAbuseFilterPager": "includes/pagers/GlobalAbuseFilterPager.php",
|
||||
|
|
|
@ -95,12 +95,13 @@
|
|||
"abusefilter-log-hide-reason": "Reason:",
|
||||
"abusefilter-log-hide-reason-other": "Other/additional reason:",
|
||||
"abusefilter-log-hide-forbidden": "You do not have permission to hide abuse log entries.",
|
||||
"abusefilter-logentry-suppress": "hid \"[[$1]]\"",
|
||||
"abusefilter-logentry-unsuppress": "unhid \"[[$1]]\"",
|
||||
"abusefilter-log-entry-suppress": "$1 {{GENDER:$2|hid}} $3",
|
||||
"abusefilter-log-entry-unsuppress": "$1 {{GENDER:$2|unhid}} $3",
|
||||
"logentry-abusefilter-hit": "$1 {{GENDER:$2|triggered}} $4, {{GENDER:$2|performing}} the action \"$5\" on $3. Actions taken: $6 ($7)",
|
||||
"log-action-filter-abusefilter": "Type of filter change:",
|
||||
"log-action-filter-abusefilter-create": "New filter creation",
|
||||
"log-action-filter-abusefilter-modify": "Filter modification",
|
||||
"log-action-filter-suppress-abuselog": "Abuse log suppression",
|
||||
"logentry-abusefilterprivatedetails-access": "$1 {{GENDER:$2|accessed}} private details for $3",
|
||||
"abusefilterprivatedetails-log-name": "AbuseFilter private details access log",
|
||||
"abusefilter-management": "Abuse filter management",
|
||||
|
|
|
@ -128,12 +128,13 @@
|
|||
"abusefilter-log-hide-reason": "{{Identical|Reason}}",
|
||||
"abusefilter-log-hide-reason-other": "{{Identical|Other/additional reason}}",
|
||||
"abusefilter-log-hide-forbidden": "Message shown instead of a \"hide log entry\" form when not having the correct user rights.",
|
||||
"abusefilter-logentry-suppress": "Log entry when hiding an abuse filter log entry. Parameters:\n* $1 is a link to the log ID with the log ID as description.",
|
||||
"abusefilter-logentry-unsuppress": "Log entry when unhiding an abuse filter log entry. Parameters:\n* $1 is a link to the log ID with the log ID as description.",
|
||||
"abusefilter-log-entry-suppress": "Log entry when hiding an abuse filter log entry. Parameters:\n* $1 - a link to a user page with a user name as link text, followed by a series of related links\n* $2 - raw username, for GENDER support\n* $3 – a link to the log ID.",
|
||||
"abusefilter-log-entry-unsuppress": "Log entry when unhiding an abuse filter log entry. Parameters:\n* $1 - a link to a user page with a user name as link text, followed by a series of related links\n* $2 - raw username, for GENDER support\n* $3 – a link to the log ID.",
|
||||
"logentry-abusefilter-hit": "This message is for a log entry. Parameters:\n* $1 - user who performed the action\n* $2 - user who performed the action (to be used with GENDER)\n* $3 - link to the page, that the action that triggered the filter was made on\n* $4 - link to filter\n* $5 - action by user, like 'edit', 'move', 'create' etc.\n* $6 - actions taken by the filter\n* $7 - action details link",
|
||||
"log-action-filter-abusefilter": "{{doc-log-action-filter-action|abusefilter}}",
|
||||
"log-action-filter-abusefilter-create": "{{doc-log-action-filter-action|abusefilter|create}}",
|
||||
"log-action-filter-abusefilter-modify": "{{doc-log-action-filter-action|abusefilter|modify}}",
|
||||
"log-action-filter-suppress-abuselog": "{{doc-log-action-filter-action|suppress|abuselog}}",
|
||||
"logentry-abusefilterprivatedetails-access": "This message is for a log entry. Parameters:\n* $1 User who accessed the private logs\n* $2 User who accessed the private logs (used for gender)\n* $3 The log entry of which private details were accessed",
|
||||
"abusefilterprivatedetails-log-name": "Log name",
|
||||
"abusefilter-management": "Title of [[Special:AbuseFilter]]",
|
||||
|
|
|
@ -18,7 +18,7 @@ class AbuseFilterHooks {
|
|||
*/
|
||||
public static function onRegistration() {
|
||||
global $wgAbuseFilterAvailableActions, $wgAbuseFilterRestrictedActions,
|
||||
$wgAuthManagerAutoConfig;
|
||||
$wgAuthManagerAutoConfig, $wgActionFilteredLogs;
|
||||
|
||||
if ( isset( $wgAbuseFilterAvailableActions ) || isset( $wgAbuseFilterRestrictedActions ) ) {
|
||||
wfWarn( '$wgAbuseFilterAvailableActions and $wgAbuseFilterRestrictedActions have been '
|
||||
|
@ -32,6 +32,12 @@ class AbuseFilterHooks {
|
|||
// Run after normal preauth providers to keep the log cleaner
|
||||
'sort' => 5,
|
||||
];
|
||||
|
||||
$wgActionFilteredLogs['suppress'] = array_merge(
|
||||
$wgActionFilteredLogs['suppress'],
|
||||
// Message: log-action-filter-suppress-abuselog
|
||||
[ 'abuselog' => [ 'hide-afl', 'unhide-afl' ] ]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
16
includes/AbuseFilterSuppressLogFormatter.php
Normal file
16
includes/AbuseFilterSuppressLogFormatter.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
class AbuseFilterSuppressLogFormatter extends LogFormatter {
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getMessageKey() {
|
||||
if ( $this->entry->getSubtype() === 'unhide-afl' ) {
|
||||
return 'abusefilter-log-entry-unsuppress';
|
||||
} else {
|
||||
return 'abusefilter-log-entry-suppress';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -321,10 +321,12 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
$this->msg( 'colon-separator' )->inContentLanguage()->text() . $fields['reason'];
|
||||
}
|
||||
|
||||
$logPage = new LogPage( 'suppress' );
|
||||
$action = $fields['hidden'] ? 'hide-afl' : 'unhide-afl';
|
||||
|
||||
$logPage->addEntry( $action, $this->getPageTitle( $logid ), $reason );
|
||||
$logEntry = new ManualLogEntry( 'suppress', $action );
|
||||
$logEntry->setPerformer( $this->getUser() );
|
||||
$logEntry->setTarget( $this->getPageTitle( $logid ) );
|
||||
$logEntry->setComment( $reason );
|
||||
$logEntry->insert();
|
||||
|
||||
$this->getOutput()->redirect( SpecialPage::getTitleFor( 'AbuseLog' )->getFullURL() );
|
||||
|
||||
|
|
Loading…
Reference in a new issue