From MediaWiki.org
Jump to: navigation, search
This page is a translated version of the page Extension:AbuseFilter and the translation is 25% complete.

Other languages:
български • ‎català • ‎čeština • ‎dansk • ‎Deutsch • ‎English • ‎español • ‎فارسی • ‎suomi • ‎français • ‎galego • ‎עברית • ‎italiano • ‎日本語 • ‎한국어 • ‎polski • ‎português • ‎português do Brasil • ‎русский • ‎sicilianu • ‎粵語 • ‎中文
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png

وضعیت انتشار:Extension status پایدار

ImplementationTemplate:Extension#type User activity, Special page, API
توضیحاتTemplate:Extension#description Allows specific behavior-based restrictions to be placed on wiki activity
Compatibility policyCompatibility#mediawiki_extensions release branches
MediaWikiTemplate:Extension#mediawiki 1.25+
PHPTemplate:Extension#php 5.4+ recommended
تغییرات پایگاه داده‌هاTemplate:Extension#needs-updatephp بله
جدول‌هاTemplate:Extension#table1 abuse_filterExtension:AbuseFilter/abuse_filter table
abuse_filter_actionExtension:AbuseFilter/abuse_filter_action table
abuse_filter_historyExtension:AbuseFilter/abuse_filter_history table
abuse_filter_logExtension:AbuseFilter/abuse_filter_log table
پروانه:Template:Extension#license GNU General Public License 2.0 or later
  • $wgAbuseFilterActions
  • $wgAbuseFilterConditionLimit
  • $wgAbuseFilterEmergencyDisableThreshold
  • $wgAbuseFilterEmergencyDisableCount
  • $wgAbuseFilterEmergencyDisableAge
  • $wgAbuseFilterParserClass
  • $wgAbuseFilterRestrictions
  • $wgAbuseFilterNotifications
  • $wgAbuseFilterNotificationsPrivate
  • $wgAbuseFilterCentralDB
  • $wgAbuseFilterIsCentral
  • $wgAbuseFilterDisallowGlobalLocalBlocks
  • $wgAbuseFilterBlockDuration
  • $wgAbuseFilterAnonBlockDuration
  • $wgAbuseFilterCustomActionsHandler
  • $wgAbuseFilterValidGroups
  • $wgAbuseFilterDefaultWarningMessage
  • $wgAbuseFilterIPMaxAge
  • $wgAbuseFilterProfile
  • $wgAbuseFilterRuntimeProfile
Added rightsTemplate:Extension#rights
  • abusefilter-view
  • abusefilter-log
  • abusefilter-log-detail
  • abusefilter-revert
  • abusefilter-private
  • abusefilter-view-private
  • abusefilter-log-private
  • abusefilter-hidden-log
  • abusefilter-hide-log
  • abusefilter-modify
  • abusefilter-modify-restricted
  • abusefilter-modify-global
Hooks usedTemplate:Extension#hook

Translate the AbuseFilter extension if it is available at translatewiki.net

Check usage and version matrix.


Open tasks · Report a bug

The AbuseFilter extension allows privileged users to set specific actions to be taken when actions by users, such as edits, match certain criteria. For example, a filter could be created to prevent anonymous users from adding external links, or to block a user who removes more than 2000 characters.


نیازی نیست که همه وابستگی‌های این ابزار نصب شوند، ولی شاید بخواهید Extension:AntiSpoof$ را برای استفاده از ابزارهای نرمال‌سازی رشته نصب کنید.


  • بارگیری کنید و پرونده‌(ها) را در یک شاخه با نام AbuseFilter در پوشۀ extensions/ خودتان قرار دهید.
  • کدهای زیر را در انتهای LocalSettings.php خودتان اضافه کنید:
    wfLoadExtension( 'AbuseFilter' );
  • اسکریپت به‌روزرسانی اجرا کنید تا به طور خودکار جدول‌های ضروری پایگاه داده‌ها که این افزونه نیازمند است را ایجاد کند.
  • YesY Done - به Special:Version در ویکی خودتان بروید تا مطئمن شوید که افزونه با موفقیت نصب شده است.

برای کاربرانی که مدیاویکی 1.26 یا جدیدتر را اجر می‌کنند:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.26 and earlier), instead of wfLoadExtension( 'AbuseFilter' );, you need to use:

require_once "$IP/extensions/AbuseFilter/AbuseFilter.php";

اختیارات کاربران

پس از نصب ابزار، باید اختیارات کاربری را در LocalSettings.php تنظیم کنید.

دسترسی توضیح
abusefilter-modify تغییر پالایهٔ خرابکاری
abusefilter-view مشاهدهٔ پالایه خرابکاری
abusefilter-log مشاهدهٔ سیاههٔ خرابکاری
abusefilter-log-detail مشاهدهٔ سیاههٔ خرابکاری به همراه جزئیات
abusefilter-private مشاهدهٔ اطلاعات خصوصی در سیاههٔ خرابکاری
abusefilter-modify-restricted ویرایش پالایه‌های خرابکاری دارای اقدامات محدودکننده
abusefilter-modify-global ایجاد یا تغییر پالایه‌های سراسری خرابکاری
abusefilter-revert واگردانی تمام تغییرات توسط یک پالایهٔ خرابکاری
abusefilter-view-private مشاهدهٔ پالایه‌های خرابکاری علامت خورده به عنوان خصوصی
abusefilter-log-private نمایش ورودی‌های خصوصی سیاهه‌های خرابکاری
abusefilter-hide-log پنهان کردن موارد سیاههٔ خرابکاری
abusefilter-hidden-log مشاهدهٔ موارد پنهان سیاههٔ خرابکاری

برای نمونه، تنظیمات زیر به مدیران اجازه می‌دهند که هرچه می‌خواهند با پالایه خرابکاری انجام دهند و همه سیاهه و تنظیمات عمومی پالایه را ببینند:

$wgGroupPermissions['sysop']['abusefilter-modify'] = true;
$wgGroupPermissions['*']['abusefilter-log-detail'] = true;
$wgGroupPermissions['*']['abusefilter-view'] = true;
$wgGroupPermissions['*']['abusefilter-log'] = true;
$wgGroupPermissions['sysop']['abusefilter-private'] = true;
$wgGroupPermissions['sysop']['abusefilter-modify-restricted'] = true;
$wgGroupPermissions['sysop']['abusefilter-revert'] = true;
پالایه‌هایی که به صورت خصوصی علامت‌گذاری شده‌اند، تنها توسط کاربرانی که اجازه تغییر پالایه یا مشاهده پالایه خصوصی را دارند، دیده می‌شوند.

Creating and managing filters

Once the extension has been installed, filters can be created/tested/changed/deleted and the logs can be accessed from the Abuse filter management page Special:AbuseFilter.


نام متغیر مقدار پیش‌فرض توضیحات
$wgAbuseFilterActions array( 'flag' => true, 'throttle' => true, 'warn' => true, 'disallow' => true, 'blockautopromote' => true, 'block' => true, 'rangeblock' => false, 'degroup' => true, 'tag' => true ) کنش‌های ممکن توسط پالایه خرابکاری
$wgAbuseFilterConditionLimit 1000 The maximum number of 'conditions' that can be used each time the filters are run against a change. (More complex filters require more 'conditions').
$wgAbuseFilterValidGroups 'default' The list of "groups" filters can be divided into. By default there is only one group.
$wgAbuseFilterEmergencyDisableThreshold array( 'default' => 0.05 ) Disable a filter if it matched more than 2 edits, constituting more than 5 % of the actions which were checked against the filter's group in the "observed" period (at most one day), unless the filter has been changed in the last 86400 seconds (one day)
$wgAbuseFilterEmergencyDisableCount array( 'default' => 2 )
$wgAbuseFilterEmergencyDisableAge array( 'default' => 86400 )
$wgAbuseFilterParserClass 'AbuseFilterParser' Name of AbuseFilter's parser class.
$wgAbuseFilterRestrictions array( 'block' => true, 'degroup' => true, 'blockautopromote' => true, 'rangeblock' => true ) Users must have the "abusefilter-modify-restricted" user right as well as "abusefilter-modify" in order to create or modify filters which carry out these actions.
$wgAbuseFilterNotifications false Allows to configure the extension to send hit notifications to Special:RecentChanges or UDP. Available options: rc, udp, rcandudp
$wgAbuseFilterNotificationsPrivate false Enable notifications for private filters.
$wgAbuseFilterCentralDB null Name of a database where global abuse filters will be stored in (only supported in the latest, development version).
$wgAbuseFilterIsCentral false Set this variable to true for the wiki where global AbuseFilters are stored in (only supported in the latest, development version).
$wgAbuseFilterDisallowGlobalLocalBlocks false Disallow Centralised filters from taking actions that locally block, remove from groups, or revoke permissions.
$wgAbuseFilterBlockDuration 'indefinite' Duration of blocks made by AbuseFilter
$wgAbuseFilterAnonBlockDuration null Duration of blocks made by AbuseFilter on users who are not logged in. The value of $wgAbuseFilterBlockDuration will be used if this is not set.
$wgAbuseFilterCustomActionsHandlers array() Callback functions for custom actions.
$wgAbuseFilterValidGroups array('default') Valid "filter groups" – used for applying edit filters to certain types of actions
$wgAbuseFilterDefaultWarningMessage array( 'default' => 'abusefilter-warning' ) Default warning messages, per filter group
$wgAbuseFilterLogIPMaxAge 3 * 30 * 24 * 3600 Age used as cutoff when purging old IP log data. Defaults to 3 months. Used by maintenance script purgeOldLogIPData.php.
$wgAbuseFilterProfile false
MediaWiki version: 1.27

Whether to record data about the performance of filters – the average number of conditions used and the time consumed by every filter.

(This was always enabled in MediaWiki up to 1.25, then entirely removed from 1.26 for performance reasons, then restored in 1.27.)

$wgAbuseFilterRuntimeProfile false Whether to calculate and record the total runtime, conditions, and matched filters on each execution.


AbuseFilter adds two API list modules, one for details of abuse filters ("abusefilters") and one for the abuse log, since it is separate from other MediaWiki logs ("abuselog"). It is not possible to create or modify abuse filters using the API.

list = abusefilters

List information about filters

  • abfstartid: The filter id to start enumerating from
  • abfendid: The filter id to stop enumerating at
  • abfdir: The direction in which to enumerate (older, newer)
  • abfshow: Show only filters which meet these criteria (enabled|!enabled|deleted|!deleted|private|!private)
  • abflimit: The maximum number of filters to list
  • abfprop: Which properties to get (id|description|pattern|actions|hits|comments|lasteditor|lastedittime|status|private)

When filters are private, some of the properties specified with abfprop will be missing unless you have the appropriate user rights.


List non-private abuse filters

list = abuselog

List instances where actions triggered an abuse filter.

  • aflstart: The timestamp to start enumerating from
  • aflend: The timestamp to stop enumerating at
  • afldir: The direction in which to enumerate (older, newer)
  • afluser: Show only entries where the action was attempted by a given user or IP address.
  • afltitle: Show only entries where the action involved a given page.
  • aflfilter: Show only entries that triggered a given filter ID
  • afllimit: The maximum number of entries to list
  • aflprop: Which properties to get (ids|user|title|action|result|timestamp|details)

List instances where the abuse filter was triggered in response to actions from the user "SineBot"

Possible errors

  • Some users might experience that creating new filters or modifying old filters fail and the user just gets redirected to the original page. If the Wiki is using SSL certificates, this error could possibly be because of the $wgServer value, which might be using "http://" instead of "https://". An indication of this error will be, the browser giving https warning for Special:AbuseFilter pages. (Topic:T23dyyih0ofjada5)

See also