Extension:AbuseFilter/bg
AbuseFilter Обявен статут: стабилен |
|
---|---|
![]() |
|
Реализация | Потребителска активност , Специална страница , API |
Описание | Позволява върху уикидейността да се поставят специфични ограничения на поведението |
Автор(и) |
|
Правило за съвместимост | release branches |
MediaWiki | 1.33+ |
PHP | 5.4+ (препоръчана) |
Промени в базата данни | Да |
Таблици | abuse_filter abuse_filter_action abuse_filter_history abuse_filter_log |
Лиценз | GNU General Public License 2.0 or later |
Изтегляне | |
|
|
|
|
|
|
Преведете разширението AbuseFilter, ако е налично в translatewiki.net | |
Проверка на употребата и използваните версии | |
Проблеми | Отворени задачи · Съобщете за грешка |
Разширението Филтър срещу злоупотреби позволява на привилегированите потребители да определят конкретни действия, които да бъдат предприемани при определени действия на потребители, например промени, съответстващи на дадени критерии.
Например, може да бъде създаден филтър, който да предотвратява добавянето на външни връзки от анонимни потребители, или да блокира потребител, който премахва повече от 2 000 знака.
Инсталиране
- Изтеглете и поставете файла (файловете) в директория, наречена
AbuseFilter
във вашата директорияextensions/
. - Only when installing from git run Composer to install PHP dependencies, by issuing
composer install --no-dev
in the extension directory. (See T173141 for potential complications.) - На дъното на вашия LocalSettings.php добавете следния код:
wfLoadExtension( 'AbuseFilter' );
- Изпълнете скрипта за поднова, който автоматично ще създаде нужните таблици в базата данни, които използват се от това разширение.
- Configure as required.
- Готово – Отидете на 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-privatedetails | Преглед на скритите данни в дневника на злоупотребите |
abusefilter-modify-restricted | Промяна на филтрите срещу злоупотреби с ограничени действия |
abusefilter-modify-global | Създаване или промяна на глобалните филтри срещу злоупотреби |
abusefilter-revert | Връщане на всички промени, направени от филтъра срещу злоупотреби |
abusefilter-view-private | Преглед на означените като скрити филтри срещу злоупотреби |
abusefilter-log-private | Преглед на записите в дневника на означените като скрити филтри срещу злоупотреби |
abusefilter-hide-log | Скриване на записи от дневника на злоупотребите |
abusefilter-hidden-log | Преглед на скритите записи от дневника на злоупотребите |
abusefilter-privatedetails-log | Преглед на достъп до лични данни от дневника на Филтъра срещу злоупотреби |
Например, следната конфигурация ще позволи на системните администратори да правят всичко, което искат с Филтъра срещу злоупотреби и всеки да може да вижда дневника и настройките на публичните филтри:
$wgGroupPermissions['sysop']['abusefilter-modify'] = true;
$wgGroupPermissions['*']['abusefilter-log-detail'] = true;
$wgGroupPermissions['*']['abusefilter-view'] = true;
$wgGroupPermissions['*']['abusefilter-log'] = true;
$wgGroupPermissions['sysop']['abusefilter-privatedetails'] = true;
$wgGroupPermissions['sysop']['abusefilter-modify-restricted'] = true;
$wgGroupPermissions['sysop']['abusefilter-revert'] = true;
Parameters
Име на променливата | Стойност по подразбиране | Описание |
---|---|---|
$wgAbuseFilterActions
|
[
'throttle' => true,
'warn' => true,
'disallow' => true,
'blockautopromote' => true,
'block' => true,
'rangeblock' => false,
'degroup' => true,
'tag' => true
]
|
Възможните действия, които могат да бъдат предприето от филтрите за злоупотреба. When adding a new action, check if it is restricted in $wgAbuseFilterRestrictions and, if it is, don't forget to add the abusefilter-modify-restricted right to the appropriate user groups.
|
$wgAbuseFilterConditionLimit
|
1000
|
Максималният брой 'условия', които могат да бъдат използвани всеки път, когато филтрите извършват проверка по отношение на изменението. (По-сложните филтри изискват повече 'условия'). |
$wgAbuseFilterValidGroups
|
[
'default'
]
|
Списъкът с "групи" филтри може да бъде разделен. По подразбиране има само една група. Other extensions may add other groups. |
$wgAbuseFilterEmergencyDisableThreshold
|
[
'default' => 0.05
]
|
Изключване на филтъра, ако той съвпадне с повече от 2 редакции, представляващи повече от 5% от действията, за които е била извършена проверка от групата филтри в "наблюдавания" период (максимум един ден), освен ако филтърът не е бил променен през последните 86 400 секунди (един ден) See emergency throttling. |
$wgAbuseFilterEmergencyDisableCount
|
[
'default' => 2
]
| |
$wgAbuseFilterEmergencyDisableAge
|
[
'default' => 86400
]
| |
$wgAbuseFilterParserClass
|
'AbuseFilterParser'
|
Име на парсерния клас на филтъра за злоупотреби. |
$wgAbuseFilterRestrictions
|
[
'block' => true,
'degroup' => true,
'blockautopromote' => true,
'rangeblock' => true
]
|
Потребителите трябва да имат "abusefilter-modify-restricted", както и "abusefilter-modify" потребителски права, за да могат да създават или променят филтри, които извършват тези действия. |
$wgAbuseFilterNotifications
|
false
|
Позволява конфигурирането на разширението да изпраща известия при съвпадение на Специални:Последни промени или UDP. Възможни опции: rc, udp, rcandudp |
$wgAbuseFilterNotificationsPrivate
|
false
|
Активиране на известия за скрити филтри. |
$wgAbuseFilterCentralDB
|
null
|
Име на базата данни, в която ще се съхраняват глобалните филтри за злоупотреби (поддържано само в последната, разработена версия). |
$wgAbuseFilterIsCentral
|
false
|
Задайте тази променлива като "true" за уикито, в която се съхраняват глобалните филтри за злоупотреби (поддържано само в последната, разработена версия). |
$wgAbuseFilterDisallowGlobalLocalBlocks
|
false
|
Забранява на централизираните филтри да предприемат действия, които на локално ниво блокират, изваждат от групи или премахват разрешения. |
$wgAbuseFilterBlockDuration
|
'indefinite'
|
Продължителност на блокиранията, направени от Филтъра срещу злоупотреби
as of 1.31.0-wmf.25 block durations may be specified for every single filter and will override this variable. This variable is only used when enabling the block in order to preselect a default duration.
|
$wgAbuseFilterAnonBlockDuration
|
null
|
Продължителност на блокиранията, направени от Филтъра срещу злоупотреби, на потребители, които не са регистрирани. Ще бъде използвана стойността на $wgAbuseFilterBlockDuration, ако не е зададена друга.
as of 1.31.0-wmf.25 block durations may be specified for every single filter and will override this variable. This variable is only used when enabling the block in order to preselect a default duration.
|
$wgAbuseFilterCustomActionsHandlers
|
[ ]
|
Callback functions for custom actions. |
$wgAbuseFilterDefaultWarningMessage | [
'default' => 'abusefilter-warning'
]
|
Предупредителни съобщения по подразбиране, по филтърни групи |
$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. |
$wgAbuseFilterProfileActionsCap
|
10000
|
Number of action that determines when to reset profiling stats. |
$wgAbuseFilterLogPrivateDetailsAccess
|
false
|
Whether accessing private information from a filter log entry is logged. |
$wgAbuseFilterPrivateDetailsForceReason
|
false
|
Whether users are forced to provide a reason for accessing private information from a filter log entry. |
- Emergency throttling
AbuseFilter comes with a feature that automatically throttles (disable) filters that have been edited recently and match a certain theresold of the latest actions.
This is done to prevent harmful edits on the filters to block every user that performs an action on the wiki or similar.
The condition to disable the filter depend on those variables:
$wgAbuseFilterEmergencyDisableThreshold
- Percent of matches over the total amount of actions in the observed period.$wgAbuseFilterEmergencyDisableCount
- Count of matches of the filter in the observed period.$wgAbuseFilterEmergencyDisableAge
- Age of the filter to take it into account. If the last edit of the filter is older than this number of seconds, the filter won't be throttled, unless it's already throttled.$wgAbuseFilterProfileActionsCap
- Maximum number of recent actions to count against the threshold. Note that each action increments a counter, and once this counter reaches this configured value, this counter and the number of recent actions that matches all filters are reset to 0.
Throttled filters can be identified in the list of filters (Special:AbuseFilter) with the state Enabled, throttled. Throttling happens silently, and there's no way to see when a filter got throttled.
When a filter gets throttled, it doesn't perform any dangerous action (the ones specified in $wgAbuseFilterRestrictions
), and only "safe" actions are allowed. Throttled filters don't get enabled automatically. To disable the throttling, you need to edit the filter. Note that you need to actually change something from the filter: changing somethin from the filter's notes is sufficient.
Note that editing the filter updates its age, and can cause it to be disabled if it reaches again the conditions to be throttled in a short period since the last edit, leading to a unusable filter if your wiki has more abuse edits than legitimate ones. Filters can also get randomly throttled if the action count reaches $wgAbuseFilterProfileActionsCap
, causing all filter matches count to reset to 0, and then someone repeatedly makes a filter to hit.
Създаване и управление на филтри
След като се инсталира разширението, е възможно създаването/тестването/ промяната/изтриването на филтри, а дневниците са достъпни от страницата за управление на Филтъра срещу злоупотреби на Special:AbuseFilter.
- Форматиране на правила - основите на това как да се напише филтър
- Действия
- Глобални правила
- Наръчник за оптимизиране на употребата на условни лимити
- За да импортирате филтри от Уикипедия: След като сте инсталирали разширението, отидете на w:Special:AbuseFilter, изберете филтър (да речем w:Special:AbuseFilter/3), след това натиснете "Експортирайте този филтър към друго уики", копирайте текста, отидете на "Special:AbuseFilter/import" на вашето уики и поставете текста.
Приложно-програмен интерфейс (API)
Филтърът срещу злоупотреби добавя два API списъчни модула, един за детайлите на филтрите за злоупотреба ("abusefilters") и един за дневника за злоупотреби, тъй като той е отделен от другите МедияУики дневници ("abuselog"). Не е възможно филтрите за злоупотреба да бъдат създавани или променяни чрез употребата на API.
list = abusefilters
Преглед на информация за филтрите
- ; Параметри
- *
abfstartid
: Идентификатор на филтъра, от който да се започне изчислението abfendid
: Идентификатор на филтъра, при който да се спре изчислениетоabfdir
: Посоката, в която да се извърши изчислението (по-стари, по-нови)abfshow
: Показване само на филтри, които отговарят на тези критерии (включени|!включени|изтрити|!изтрити|скрити|!скрити)abflimit
: Максимален брой филтри в списъкаabfprop
: Какви свойства да получат (ID|описание|модел|действия|съвпадения|коментари|последен редактор|време на последна редакция|статус|скрит):abfstartid
- The filter id to start enumerating fromabfendid
- The filter id to stop enumerating atabfdir
- 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 listabfprop
- Which properties to get (id|description|pattern|actions|hits|comments|lasteditor|lastedittime|status|private)
Когато филтрите са скрити, някои от свойствата, определени с abfprop
няма да се показват, освен ако нямате съответните потребителски права.
- ;Примери
Преглед на публичните филтри за злоупотреби
list = abuselog
Преглед на случаи, при които дадени действия задействат филтър за злоупотреби.
- ;Parameters
aflstart
: Времевата отметка от която да започне изчислениетоaflend
: Времевата отметка на която да спре изчислениетоafldir
: Посоката, в която да се извърши изчислението (по-стари, по-нови)afluser
: Показване само на записи, в които действието е извършено от определен потребител или IP адресafltitle
: Показване само на записи, в които действието включва дадена страница.aflfilter
:Показване само на записи, които задействат определена филтърна групаafllimit
: Максимален брой записи в списъкаaflprop
: Какви свойства да получат (ID|потребител|заглавие|действие|резултат|времева отметка|детайли):aflstart
- The timestamp to start enumerating fromaflend
- The timestamp to stop enumerating atafldir
- 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 IDafllimit
- The maximum number of entries to listaflprop
- Which properties to get (ids|user|title|action|result|timestamp|details)
- ;Пример
Преглед на случаи, в които филтърът за злоупотреби е задействан в отговор на действия от потребителя "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)
Integration with other extensions
You can integrate AbuseFilter with other extension in various ways.
Adding variables for filtering
It is possible to add new variables, to be used in abuse filters. A list of examples is available . To do that, you should:
- Add a handler for the AbuseFilter-builder hook. To add a variable, you should use
$builder['vars']['variable_name'] = 'i18n-key';
, wherevariable_name
is the name of the variable, andi18n-key
is the fragment of an i18n key. The full key will beabusefilter-edit-builder-vars-{$your_key}
. - Add the i18n messages you chose at the previous point.
- Choose a hook handler where the variable will be computed. Depending on your use case, you could:
- Implement the AbuseFilter-generateTitleVars hook; this is specifically thought for page-related variables;
- Implement the AbuseFilter-generateUserVars hook; this is specifically thought for user-related variables;
- Implement the AbuseFilter-generateStaticVars hook; this is specifically thought for "static" variables, i.e. variables whose value shouldn't depend on the context. This is rarely useful;
- Implement the AbuseFilterAlterVariables hook; this is a bit more flexible than the other hooks, but it has a downside: your variable will not be available when examining past RecentChanges entries. If you want to implement that feature (and it's recommended to do so), you should use one of the hooks listed above, and use its third parameter (
$RCRow
).
- Inside the hook handler, there are two ways to add a variable:
- The "direct" way is calling
$vars->setVar( 'var_name', var_value );
. This is ideal only when the value is easy and quick to compute: the value is computed even if no active filter will use it. - The "lazy" way is calling
$vars->setLazyLoadVar( 'var_name', 'method_name', $params );
. Here, 'method_name' is a (unique) identifier that will be used to compute the variable (it's recommended to prefix it with the name of your extension). To register the method, you should add a handler for the AbuseFilter-computeVariable hook; therein, you should check if the $method passed matches your 'method_name', and if so, compute the variable. Lastly, $params is an array of parameters that you'll need to compute the variable; these are passed to the computeVariable hook handler. For an example of this, you can check out CentralAuth'sglobal_user_groups
.
- The "direct" way is calling
Adding rule groups
You can also add extra rule groups, which can be used to group existing abuse filters. Note that, at the moment, each filter can only be in a single group (T116642). Currently, the only known consumer of this feature is Flow. To do that, you should:
- Append the name of the group to
$wgAbuseFilterValidGroups
- Add some code to run the filters with your group. Note that AbuseFilter won't do that on its own. To do that, you should construct an
AbuseFilterRunner
object, passing in the name of your group.
Вижте също
- Няколко уикита на Фондация Уикимедия, които използват филтри срещу злаупотреби (и с каква конфигурация)
This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page. |