Extension:AbuseFilter/Rules format/zh

From MediaWiki.org
Jump to navigation Jump to search
其他语言: English  • 日本語 • 한국어 • मराठी • русский • 中文

防滥用过滤器的语法格式与类C/JAVA/Perl语言的条件式十分相近。

字符串[edit]

你可以在单引号或双引号中填写字符串常量,亦可直接填写数字变量(包括整型与浮点型)。你可以使用\n来换行,而且你还可以使用半角反斜杠来转义引号字符。

Use the + (plus) symbol to concatenate two literal strings or the values of two vars with a string value.

"这是一条字符串"
'这也是一条字符串'
'虽然有单引号\',但这条字符串仍然有效'
"这是一条带有\n换行符的字符串"
1234
1.234
-123

用戶自訂變數[edit]

你可以定義自訂的變數,只要在一行中使用賦值符號:=(以;結尾)並跟隨一個條件。這些變數可以使用字母、下劃線和數字(除第一個字符外),並且區分大小寫。例如(來自w:en:Special:AbuseFilter/79):

(
	line1:="(\{\{(r|R)eflist|\{\{(r|R)efs|<references\s?/>|</references\s?>)";
	rcount(line1, removed_lines)
) > (
	rcount(line1, added_lines)
)

陣列[edit]

AbuseFilter has support for non-associative arrays, which can be used like in the following examples.

my_array := [ 5, 6, 7, 10];
my_array[0] == 5
length(my_array) == 4
string(my_array) == "5\n6\n7\n10\n" //注意:最後一個換行將在未來移除
5 in my_array == true
'5' in my_array == true
'5\n6' in my_array == true //注意:與陣列轉型為字串的方式相同,即使用換行來implode陣列。
1 in my_array == true //注意:因為「in」指令將變數轉型為字串,所以 1 在 10 中被找到且回傳 true。

注釋[edit]

您可以使用以下語法來注釋:

/* This is a comment */

算术[edit]

你可以使用基本的算术符号对变量和常量进行算术运算,语法规则如下:

  • - — 用左操作数减去右操作数。
  • + — 将左、右操作数相加。
  • * — 将左、右操作数相乘。
  • / — 用右操作数去除左操作数(右操作数不得為0)。
  • ** — 对左操作数求幂,幂次由右操作数指定。
  • % — 返回左操作数除以右操作数后的余数(右操作数不得為0)。

The type of the returned result is the same that would be returned by PHP, for which a lot of documentation may be found online. More exhaustive examples may be found in this AF parser test.

Example Result
1 + 1 2
2 * 2 4
1 / 2 0.5
9 ** 2 81
6 % 5 1

布尔运算[edit]

你可以要求满足所有条件为真,或满足任一条件为真,或只满足任一条件为真。

  • x | y — OR – 如果两个条件中有一个或多个为真,则返回真值True。
  • x & y — AND – 如果两个条件中所有条件都为真,则返回真值True。
  • x ^ y — XOR – 如果两个条件中当且仅当一个条件为真,则返回真值True。
  • !x — NOT – 如果条件为假,则返回真值True。

範例

語法 結果
1 | 1 true
1 | 0 true
0 | 0 false
1 & 1 true
1 & 0 false
0 & 0 false
1 ^ 1 false
1 ^ 0 true
0 ^ 0 false
!1 false

简单的比较[edit]

你可以将变量与其他变量进行比较及運算,以下是语法规则:

  • <>—如果左運算元分別小於/大於右運算元,則返回true。Watch out: operands are casted to strings and, like it happens in PHP, null < any number === true and null > any number === false.
  • <=>=—如果左運算元分別小於或等於/大於或等於右運算元,則返回true。Watch out: operands are casted to strings and, like it happens in PHP, null <= any number === true and null >= any number === false.
  • ==(或=)和!=—如果左運算元分別等於/不等於右運算元,則返回true。
  • ===!==—如果左運算元等於右運算元左運算元的資料類型等於右運算元的資料類型,則返回true,只要有一個不符合,返回false。
Example Result
1 == 2 false
1 <= 2 true
1 >= 2 false
1 != 2 true
1 < 2 true
1 > 2 false
2 = 2 true
'' == false true
'' === false false
1 == true true
1 === true false
['1','2','3'] == ['1','2','3'] true
[1,2,3] === [1,2,3] true
['1','2','3'] == [1,2,3] true
['1','2','3'] === [1,2,3] false
[1,1,''] == [true, true, false] true
[] == false & [] == null true
['1'] == '1' false[1]

內建變數[edit]

防滥用过滤器可以根据变量的名称将各种变量传送给解析器。你可以输入这些变量的名称来访问它们,就像访问常量一样。在过滤日志中,你还可以看到各请求的相关变量。

來自防濫用過濾器的變數[edit]

可用變數
变量描述 变量名 資料型態 变量值
動作 action 字串 以下之一:edit(编辑)、move(移动)、createaccount(创建用户)、autocreateaccount(自動创建用户)、delete(删除)、upload[2]、stashupload[3]
用户的编辑次数 user_editcount 整數/Null 匿名用戶為Null
用户账户名称 user_name 字串 注意:"createaccount"動作時為空,請使用accountname
电子邮件地址得到确认的时间 user_emailconfirm 字串 以YYYYMMDDHHMMSS的格式
用户账户的年龄 user_age 單位為秒;IP為0
用户是否被封禁 user_blocked 布尔 已封禁註冊帳戶為true、匿名用戶為false。注意:這無法區分部分封禁及全站封禁。
用户所在群组(包括隐藏群组) user_groups 字串陣列 Special:ListGroupRights
用户拥有的权限 user_rights 字串陣列 Special:ListGroupRights
页面编号 article_articleid integer Deprecated. Use page_id instead.
页面编号 (可在頁面的HTML原始碼搜尋wgArticleId找到) page_id 整數 理論上新建页面时为0,但这不一定可靠,请用page_age == 0判断是否为新建页面
页面名字空间 article_namespace integer Deprecated. Use page_namespace instead.
页面名字空间 page_namespace 整數 參見名字空间索引
页面年龄(以秒为单位) page_age integer the number of seconds since the first edit (or 0 for new pages)
页面标题(不含名字空间) article_text string Deprecated. Use page_title instead.
页面标题(不含名字空间) page_title string
完整页面标题 article_prefixedtext string Deprecated. Use page_prefixedtitle instead.
完整页面标题 page_prefixedtitle string
页面的编辑保护级别 article_restrictions_edit string Deprecated. Use page_restrictions_edit instead.
页面的编辑保护级别 page_restrictions_edit 字串陣列
页面的移动保护级别 article_restrictions_move string Deprecated. Use page_restrictions_move instead.
页面的移动保护级别 page_restrictions_move 字串陣列
上传文件的保护 article_restrictions_upload string Deprecated. Use page_restrictions_upload instead.
上传文件的保护 page_restrictions_upload 字串陣列
创建页面的保护 article_restrictions_create string Deprecated. Use page_restrictions_create instead.
创建页面的保护 page_restrictions_create 字串陣列
最后十位对该页面贡献的用户 article_recent_contributors array of strings Deprecated. Use page_recent_contributors instead.
最后十位对该页面贡献的用户 page_recent_contributors 字串陣列 This tends to be slow (see #Performance). Try to put conditions more likely evaluate to false before this one, to avoid unnecessarily running the query. 若該頁面僅由一位使用者貢獻則為空值(不確定),最多統計100個歷史版本
贡献页面的第一位用户 article_first_contributor string Deprecated. Use page_first_contributor instead.
贡献页面的第一位用户 page_first_contributor string This tends to be slow (see #Performance).[4] Try to put conditions more likely evaluate to false before this one, to avoid unnecessarily running the query.
對部分動作可用的變數
变量描述 变量名 資料型態 变量值
编辑摘要/原因 summary string Summaries automatically created by MediaWiki ("New section", "Blanked the page", etc.) are created after the filter checks the edit, so they will never actually catch, even if the debugger shows that they should.[5]
编辑是否被标记为小编辑 minor_edit 字串 停用,且對於2016到2018年間的所有項目皆被設為false。[6]
旧页面的wiki文本,在编辑之前(不再继续使用) old_wikitext 字串 This variable can be very large. Consider using removed_lines if possible to improve performance.
编辑后的新页面,wiki代码格式 new_wikitext 字串 This variable can be very large. Consider using added_lines if possible to improve performance.
编辑产生的差异 edit_diff 字串
统一所有由编辑、预保存转换更改的差异 edit_diff_pst 字串 This tends to be slow (see #Performance). Checking both added_lines and removed_lines is probably more efficient.[7]
新页面大小 new_size 整數
旧页面大小 old_size 整數
编辑前后的大小改变 edit_delta integer Tip: ensure that the action being filtered is an edit, either by checking for action === 'edit' or checking other edit-specific variables. Otherwise, edit_delta will be null, thus being considered less than every other number (see #简单的比较).
编辑中加入了行,并在保存前转换 added_lines_pst 字串 Use added_lines if possible, which is more efficient.
编辑增加的行 added_lines 字串陣列 最後差異中所有以+開頭的行
编辑移除的行 removed_lines 字串陣列
新内容中的所有外部链接 all_links 字串陣列
旧内容中的所有外部链接 old_links 字串陣列
新内容中新增的所有外部链接 added_links 字串陣列 This tends to be slow (see #Performance). Consider checking against added_lines first, then check added_links so that fewer edits are slowed down. This follows MediaWiki's rules for external links. Only unique links are added to the array. Changing a link will count as 1 added and 1 removed link.
新内容中移除的所有外部链接 removed_links 字串陣列 This tends to be slow (see #Performance). Consider checking against removed_lines first, then check removed_links so that fewer edits are slowed down. This follows MediaWiki's rules for external links. Only unique links are added to the array. Changing a link will count as 1 added and 1 removed link.
新页面维基语言,预保存转换 new_pst 字串
编辑后的新页面,已解析为HTML源码 new_html 字串 This variable can be very large. Consider using added_lines if possible to improve performance.
编辑后的新页面,wiki代码格式 new_text 字串 This variable can be very large. Consider using added_lines if possible to improve performance.
旧页面的wiki文本,解析为HTML(不再继续使用) old_html 字串 因效能原因而被停用
旧页面的wiki文本,在编辑之前(不再继续使用) old_text 字串 因效能原因而被停用
更改的Unix時間戳 timestamp 字串 使用 int(timestamp) 來取得整數以用來計算日期、時間、星期等等
文件内容的SHA1值 file_sha1 字串 [2]
文件大小,单位字节 file_size 整數 檔案大小,單位為位元組[2]
文件宽度(像素) file_width 整數 寬度以像素為單位[2]
文件高度(像素) file_height 整數 高度以像素為單位[2]
文件的位/颜色通道 file_bits_per_channel integer The amount of bits per color channel[2]
移动目的页面的页面编号 moved_to_articleid 整數 Deprecated. Use moved_to_id instead.
移动目的页面的页面编号 moved_to_id 整數
移动目的页面的标题 moved_to_text string Deprecated. Use moved_to_title instead.
移动目的页面的标题 moved_to_title string
移动目的页面的完整标题 moved_to_prefixedtext string Deprecated. Use moved_to_prefixedtitle instead.
移动目的页面的完整标题 moved_to_prefixedtitle string
移动目的页面的名字空间 moved_to_namespace string
移动目标页面年龄(以秒为单位) moved_to_age integer
移动源页面的名字空间 moved_from_namespace string
移动源页面的标题 moved_from_text string Deprecated. Use moved_from_title instead.
移动源页面的标题 moved_from_title string
移动源页面的完整标题 moved_from_prefixedtext string Deprecated. Use moved_from_prefixedtitle instead.
移动源页面的完整标题 moved_from_prefixedtitle string
移动源页面的页面编号 moved_from_articleid 整數 Deprecated. Use moved_from_id instead.
移动源页面的页面编号 moved_from_id 整數
移动来源页面年龄(以秒为单位) moved_from_age integer
帐户(创建时)的名称 accountname string
舊版本的內容模型 old_content_model 字串 參見Help:ChangeContentModel有關更改內容模型的資料
新版本的內容模型 new_content_model 字串 參見Help:ChangeContentModel有關更改內容模型的資料

來自其他擴充功能的變數[edit]

变量描述 变量名 資料型態 变量值 由誰加入
该用户的全域用户组 global_user_groups array CentralAuth
结构式讨论版块的页面ID board_articleid integer Deprecated. Use board_id instead. StructuredDiscussions
结构式讨论版块的页面ID board_id integer StructuredDiscussions
结构式讨论版块的名字空间 board_namespace integer 參見名字空间索引 StructuredDiscussions
结构式讨论版块的标题(没有名字空间) board_text String Deprecated. Use board_title instead. StructuredDiscussions
结构式讨论版块的标题(没有名字空间) board_title string StructuredDiscussions
结构式讨论版块的完整标题 board_prefixedtext String Deprecated. Use board_prefixedtitle instead. StructuredDiscussions
结构式讨论版块的完整标题 board_prefixedtitle string StructuredDiscussions
翻译单元的原始文本 translate_source_text string Translate
修改是否经过Tor节点完成 tor_exit_node boolean true if the action comes from a tor exit node. TorBlock
用户是否通过移动版界面编辑 user_mobile boolean true for mobile users, false otherwise. MobileFrontend
用户是否正使用移动应用进行编辑 user_app boolean true if the user is editing from the mobile app, false otherwise. MobileApp
用户是否正在通过维基百科零计划的免流量提供方编辑 user_wpzero boolean Note: This variable is only valid when filtering an action. When examining a past edit or batch testing, it'll always be null. WikimediaEvents
⧼abusefilter-edit-builder-vars-page-views⧽ article_views integer Deprecated. Use page_views instead. HitCounters
⧼abusefilter-edit-builder-vars-page-views⧽ page_views integer the amount of page views HitCounters
⧼abusefilter-edit-builder-vars-movedfrom-views⧽ moved_from_views integer the amount of page views of the source page HitCounters
⧼abusefilter-edit-builder-vars-movedto-views⧽ moved_to_views integer the amount of page views of the target page HitCounters
⧼abusefilter-edit-builder-vars-is-proxy⧽ is_proxy integer Whether this action was performed through a proxy AutoProxyBlock
⧼abusefilter-edit-builder-vars-sfs-blocked⧽ sfs_blocked boolean Whether the IP address is blocked using the stopforumspam.com list StopForumSpam

Notes[edit]

When action='move', only the summary, action, timestamp and user_* variables are available. The page_* variables are also available, but the prefix is replaced by moved_from_ and moved_to_, that represent the values of the original article name and the destination one, respectively. For example, moved_from_title and moved_to_title instead of page_title.

Since MediaWiki 1.28 (https://gerrit.wikimedia.org/r/#/c/295254/), action='upload' is only used when publishing an upload, and not for uploads to stash. A new action='stashupload' is introduced, which is used for all uploads, including uploads to stash. This behaves like action='upload' used to, and only provides file metadata variables (file_*). Variables related to the page edit, including summary, new_wikitext and several others, are now available for action='upload'. For every file upload, filters may be called with action='stashupload' (for uploads to stash), and are always called with action='upload'; they are not called with action='edit'.

Filter authors should use action='stashupload' | action='upload' in filter code when a file can be checked based only on the file contents – for example, to reject low-resolution files – and action='upload' only when the wikitext parts of the edit need to be examined too – for example, to reject files with no description. This will allow tools that separate uploading the file and publishing the file (e.g. UploadWizard or upload dialog) to inform the user of the failure before they spend the time filling in the upload details.

Performance[edit]

As noted in the table above, some of these variables can be very slow. While writing filters, remember that the condition limit is not a good metric of how heavy filters are. For instance, variables like *_recent_contributors or *_links always need a DB query to be computed, while *_pst variables will have to perform parsing of the text, which again is a heavy operation; all these variables should be used very, very carefully. For instance, on Italian Wikipedia it's been observed that, with 135 active filters and an average of 450 used conditions, filters execution time was around 500ms, with peaks reaching 15 seconds. Removing the added_links variable from a single filter, and halving the cases when another filter would use added_lines_pst brought the average execution time to 50ms. More specifically:

  • Use _links variables when you need high accuracy and checking for "http://..." in other variables (for instance, added_lines) could lead to heavy malfunctioning;
  • Use _pst variables when you're really sure that non-PST variables aren't enough. You may also conditionally decide which one to check: if, for instance, you want to examine a signature, check first if added_lines contains ~~~;
  • In general, when dealing with these variables, it's always much better to consume further conditions but avoid computing heavy stuff. In order to achieve this, always put heavy variables as last conditions.

Last but not least, note that whenever a variable is computed for a given filter, it'll be saved and any other filter will immediately retrieve it. This means that one single filter computing this variable counts more or less as dozens of filters using it.

关键词[edit]

Where not specifically stated, keywords cast their operands to strings

常用功能中通常會包含以下特殊关键词:

  • like(或matches) — 如果左字符串能够匹配右字符串指定的通配符,则返回真值True。
  • in — 如果左字符串包含右字符串,则返回真值True。注意:空字符串不被包含在任何其他字串,不包含任何其他字符串(甚至不包含空字符串本身)。
  • contains — 類似in,但左右操作符交換位置。注意:空字符串不被包含在任何其他字串,不包含任何其他字符串(甚至不包含空字符串本身)。
  • rlike(或regex)和irlike — 如果左字符串能够匹配右字符串指定的正则表达式,则返回真值True(irlike是不區分大小寫)。此系統使用PCRE,只有PCRE_UTF8PHP修飾字u)選項被啟用。irlikePCRE_CASELESSPCRE_UTF8選項被啟用(修飾字iu).
  • if ... then ... else ... end
  • ... ? ... : ...
  • truefalsenull


範例

語法 結果 備註
"1234" like "12?4" True
"1234" like "12*" True
"foo" in "foobar" True
"foobar" contains "foo" True
"o" in ["foo", "bar"] True Due to the string cast
"foo" regex "\w+" True
"a\b" regex "a\\\\b" True To look for the escape character backslash using regex you need
to use either four backslashes or two \x5C. (Either works fine.)
"a\b" regex "a\x5C\x5Cb" True

函数[edit]

为了简化一些常见的操作,防滥用过滤器提供了一系列内建的函数。它们具有相同的格式functionName(arg1,arg2,arg3),并可以放置在常量或变量的位置使用。它的参数可以是常量,可以是变量,亦可以是别的函数。

函数名 描述
lcase 将第一个参数转换为小写字母并返回之。
ucase 将第一个参数转换为大写字母并返回之。
length 返回第一个参数给出字符串的长度。如果參數是陣列,將返回元素個數。
string 转换为字符串数据类型。如果參數是陣列,將用換行來implode。
int 转换为整数数据类型。
float 转换为浮点数据类型。
bool 转换为布尔数据类型
norm 等价于rmwhitespace(rmspecials(rmdoubles(ccnorm(arg1))))
ccnorm 规范化参数中的易混淆/相近字符,并以标准形式返回之。A list of characters and their replacements can be found on git, eg. ccnorm( "Eeèéëēĕėęě3ƐƷ" ) === "EEEEEEEEEEEEE".[8] The output of this function is always uppercase.
ccnorm_contains_any Normalises confusable/similar characters in the arguments, and returns true if the first string contains any strings from the following arguments (unlimited number of arguments, logic OR mode). A list of characters and their replacements can be found on git.
ccnorm_contains_all Normalises confusable/similar characters in the arguments, and returns true if the first string contains every strings from the following arguments (unlimited number of arguments, logic AND mode). A list of characters and their replacements can be found on git.
specialratio 返回参数中非字母字符除以所有字符的结果,亦即返回特殊字符比。
rmspecials 移除参数中特殊字符,并返回结果。(Equivalent to s/[^\p{L}\p{N}]//g.)
rmdoubles 移除参数中重复的字符,并返回结果。
rmwhitespace 移除空白(空格、制表符、换行符)。
count 返回指针(第一个字符串)在栈(第二个字符串)中出现的次数。如果只给出一个参数,则默认使用半角逗号分割,并返回分割后片段的个数。
rcount 与“count”类似,但指针使用正则表达式。Can be made case-insensitive by letting the regular expression start with "(?i)".
get_matches MW 1.31+ Looks for matches of the regex needle (first string) in the haystack (second string). Returns an array where the 0 element is the whole match and every [n] element is the match of the n'th capturing group of the needle. Can be made case-insensitive by letting the regular expression start with "(?i)". If a capturing group didn't match, that array position will take value of false.
ip_in_range 若用户IP(第一个字符串)与指定IP段(第二个字符串)匹配,则返回真值true。Only works for anonymous users. Supports both IPv4 and IPv6 addresses.
contains_any 若第一个字符串包含任何之后参数内的字符串(不限制参数数量),则返回真值true。如果第一個參數是一個陣列,它將被轉換為字符串。
contains_all Returns true if the first string contains every strings from the following arguments (unlimited number of arguments in logic AND mode). If the first argument is an array, it gets casted to string.
equals_to_any Returns true if the first argument is identical (===) to any of the following ones (unlimited number of arguments). Basically, equals_to_any(a, b, c) is the same as a===b | a===c, but more compact and saves conditions.
substr Returns the portion of the first string, by offset from the second argument (starts at 0) and maximum length from the third argument (optional).
strlen 等价于“length”。
strpos 返回第一次匹配指针(第二个字符串)时,其位于栈(第一个字符串)的位置。starting from offset from the third argument (optional, default is 0). 当指针匹配栈的开头时,该函数会返回0,所以其可能被判斷为false。更好的方法是使用===!==以检测是否发现。
str_replace 用替换字符串替换所有匹配的搜索字符串。该函数有3个参数,其依次为:进行搜索的文本,搜索文本,替换文本。
rescape Returns the argument with some characters preceded with the escape character "\", so that the string can be used in a regular expression without those characters having a special meaning.
set 设定一个变量(第一个字符串)以给定值(第二个字符串),以备过滤器进一步使用。等价语法为:name := value.
set_var 等于“set”。

範例[edit]

語法 結果 備註
length( "Wikipedia" ) 9
lcase( "WikiPedia" ) wikipedia
ccnorm( "w1k1p3d14" ) WIKIPEDIA ccnorm output is always uppercase
ccnorm( "ωɨƙɩᑭƐƉ1α" ) WIKIPEDIA
ccnorm_contains_any( "w1k1p3d14", "wiKiP3D1A", "foo", "bar" ) true
ccnorm_contains_any( "w1k1p3d14", "foo", "bar", "baz" ) false
ccnorm_contains_any( "w1k1p3d14 is 4w3s0me", "bar", "baz", "some" ) true
ccnorm( "ìíîïĩїį!ľ₤ĺľḷĿ" ) IIIIIII!LLLLLL
norm( "!!ω..ɨ..ƙ..ɩ..ᑭᑭ..Ɛ.Ɖ@@1%%α!!" ) WIKIPEDAIA
norm( "F00 B@rr" ) FOBAR norm removes whitespace, special characters and duplicates, then uses ccnorm
rmdoubles( "foobybboo" ) fobybo
specialratio( "Wikipedia!" ) 0.1
count( "foo", "foofooboofoo" ) 3
count( "foo,bar,baz" ) 3
rmspecials( "FOOBAR!!1" ) FOOBAR1
rescape( "abc* (def)" ) abc\* \(def\)
str_replace( "foobarbaz", "bar", "-" ) foo-baz
ip_in_range( "127.0.10.0", "127.0.0.0/12" ) true
contains_any( "foobar", "x", "y", "f" ) true
get_matches( "(foo?ba+r) is (so+ good)", "fobaaar is soooo good to eat" ) ['fobaaar is soooo good', 'fobaaar', 'soooo good']

运算符的顺序[edit]

运算符通常是按从左向右的顺序运算的,但各运算符的优先级并不相同。As soon as the filter fails one of the conditions, it will stop checking the rest of them (due to short-circuit evaluation) and move on to the next filter (except for phab:T43693).運算顺序如下:

  1. 由半角圆括号(“(”与“)”)括住的内容会被作为一个独立单元首先运算出。
  2. 将变量/常量转换为它们所代表的数据。(如page_namespace to 0)
  3. 调用函数(normlcase等)
  4. 一元运算符+和-(定義正值或負值,例:-1234+1234
  5. 关键词
  6. 布尔反向(!x
  7. 求幂(2**3 → 8
  8. 乘法相关(乘、除、模)
  9. 加减法(3-2 → 1
  10. 比较(<>==
  11. 布尔运算(&|^in

範例[edit]

  • A & B | C is equivalent to (A & B) | C, not to A & (B | C). In particular, both false & true | true and false & false | true evaluates to true.
  • A | B & C is equivalent to (A | B) & C, not to A | (B & C). In particular, both true | true & false and true | false & false evaluates to false.

Condition counting[edit]

The condition limit is (more or less) tracking the number of comparison operators + number of function calls entered.

Further explanation on how to reduce conditions used can be found at Extension:AbuseFilter/Conditions.

Exclusions[edit]

Although the AbuseFilter examine function will identify "rollback" actions as edits, the AbuseFilter will not evaluate rollback actions for matching. [9]

Useful links[edit]

Notes[edit]

  1. Comparing arrays to other types will always return false, except for the example above
  2. 2.0 2.1 2.2 2.3 2.4 2.5 檔案上傳(action='upload') 可用的變數只有 user_*, page_*, file_sha1, file_size, file_mime, file_mediatype, file_width, file_height, file_bits_per_channel (最後五個變數在 MediaWiki 1.27+ 才被加入,gerrit:281503)。所有的 file_* 變數對其他動作都不可用(包含action='edit')。
  3. MediaWiki 1.28+ (https://gerrit.wikimedia.org/r/#/c/295254/)
  4. Several filters (12) that use this variable have showed up in the AbuseFilterSlow Grafana dashboard (requires logstash access to view). Moving this variable to towards the end of the filter seemed to help.
  5. See phabricator:T191722
  6. 此commit起棄用,且自起停用。
  7. Some filters using this variable have showed up in the AbuseFilterSlow Grafana dashboard (example, requires logstash access). For instance, instead of using "text" in edit_diff_pst (or even edit_diff), consider something like "text" in added_lines & !("text" in removed_lines)
  8. Be aware of phab:T27619. You can use Special:AbuseFilter/tools to evaluate ccnorm( "your string" ) to see which characters are transformed.
  9. T24713 - rollback not matched by AF