Anonymous user
User:松/Drafts/Extension:AbuseFilter/Rules format: Difference between revisions
User:松/Drafts/Extension:AbuseFilter/Rules format (view source)
Revision as of 02:42, 1 January 2015
, 9 years agono edit summary
No edit summary |
No edit summary |
||
Line 1:
{{DISPLAYTITLE:*}}
The rules are formatted much as conditionals in a C/Java/Perl-like language.
Line 14 ⟶ 15:
'''Action''' variable can be <code>'edit'</code>, <code>'move'</code>, <code>'createaccount'</code>, <code>'autocreateaccount'</code>, <code>'delete'</code> or <code>'upload'</code>.
You can define more variables for ease of understanding with the assign symbol <code>:=</code> in a line (closed by <code>;</code>) within a condition. Example (from
Lists:
=== <ref name="bug27987">Be aware of bug 27987</ref> ===
====All variables====
{| class="wikitable sortable"
|+ Variables available
! Description !! Name !! Data type
|-
| {{int:abusefilter-edit-builder-vars-user-editcount}} || <code>user_editcount</code> || string
|-
| {{int:abusefilter-edit-builder-vars-user-name}} || <code>user_name</code> || string
|-
| {{int:abusefilter-edit-builder-vars-user-emailconfirm}} || <code>user_emailconfirm</code> || string
|-
| {{int:abusefilter-edit-builder-vars-user-age}} || <code>user_age</code> ||
|-
| {{int:abusefilter-edit-builder-vars-user-groups}} || <code>user_groups</code> ||
|-
| {{int:abusefilter-edit-builder-vars-user-rights}} || <code>user_rights</code> ||
|-
|
|-
| {{int:abusefilter-edit-builder-vars-article-
|-
| {{int:abusefilter-edit-builder-vars-article-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-restrictions-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| Action || <code>action</code> || string
|-
|
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
| {{int:abusefilter-edit-builder-vars-
|-
|
|-
|
|-
|
|-
| ''Disabled'' || <code>
|-
|
|-
|
|}
Line 109 ⟶ 98:
===Page/Article namespace===
''See also
{| class="wikitable" style="float: right; margin:1em 0 1em 1em; text-align: center; font-size: 90%;"
!
|-
!Talk namespaces
|-
| 1
|-
| 3
|-
| 5
|-
| 7
|-
| 9
|-
| 11
|-
| 13
|-
| 15
|-
| 101
|-
| 109
|-
!
|-
|[[Wikipedia:Wikipedia:Special namespace|Special]]
|-
|[[Wikipedia:Wikipedia:Media namespace|Media]]
|}
Line 181 ⟶ 137:
* <code>==</code> (or <code>=</code>) and <code>!=</code> — Return true if the left-hand operand is ''equal to/not equal to'' the right-hand operand respectively.
* <code>===</code> and <code>!==</code> — Return true if the left-hand operand is ''equal to/not equal to'' the right-hand operand AND the left-hand operand is ''the same/not the same'' data type to the right-hand operand respectively.
=== Arithmetic ===
Line 211 ⟶ 146:
* <code>**</code> — Raise the left-hand operand to the exponential power specified by the right-hand operand.
* <code>%</code> — Return the remainder given when the left-hand operand is divided by the right-hand operand.
=== String concatenation ===
Line 231 ⟶ 152:
=== Keywords ===
The following special keywords are included for often-used functionality:
* <code>like</code> (or <code>matches</code>) returns true if the left-hand operand matches the
* <code>in</code> returns true if the right-hand operand (a string) contains the left-hand operand.
* <code>rlike</code> (or <code>regex</code>) and <code>irlike</code> return true if the left-hand operand matches (contains) the
* <code>contains</code>
* <code>if ... then ... else ... end</code>
Line 241 ⟶ 162:
'''Examples'''
=== Functions ===
A number of built-in functions are included to ease some common issues. They are executed in the general format <code>functionName( arg1, arg2, arg3 )</code>, and can be used in place of any literal or variable. Its arguments can be given as literals, variables, or even other functions.
'''Other'''
* <code>convert</code> returns the second argument converted to variant language specified by the first argument. ONLY apply on wikis with LanguageConverter class. (New func added on
'''Examples'''
<!--
|-
| <code>convert( "zh-hant", "维基百科" )</code><br />// assume we work on a wiki with Chinese LanguageConverter class
| 維基百科
-->=== Boolean operations ===
You can match if and only if all of a number of conditions are true, one of a number of conditions are true, or one and only one of all conditions are true.
* <code>x | y</code> — OR – returns true if one or more of the conditions is true.
Line 366 ⟶ 180:
* <code>!x</code> — NOT – returns true if the condition is not true.
* '''Examples'''<ref>The last 4 conditions are counted due to [[bugzilla:41693|bug 41693]]</ref>
=== Order of operations ===
Operations are generally done left-to-right, but there is an order to which they are resolved. As soon as the filter fails one of the conditions, it will stop checking the rest of them (due to
# Anything surrounded by parentheses (<code>(</code> and <code>)</code>) is evaluated as a single unit.
# Turning variables/literals into their respective data. (i.e., <code>article_namespace</code> to 0)
Line 422 ⟶ 200:
== Conditions ==
<references/>
== Useful links ==
*
== Notes ==
{{languages|Extension:AbuseFilter/Rules format}}
[[zh:Wikipedia:防滥用过滤器/操作指引]]
__FORCETOC__
__NOEDITSECTION__
__DISAMBIG__
__INDEX__
__NEWSECTIONLINK__
|