User:松/Drafts/Extension:AbuseFilter/Rules format: Difference between revisions

Translation code removal
(Translation code removal)
(Translation code removal)
Line 222:
====Variables always available====
 
{{Caution|1=<translate><!--T:414--> User-related variables are always available, except for one case: account creation when the creator is not logged in.</translate> <translate><!--T:415--> All variables starting with <tvar|1>=<code>user_</code></> are affected.</translate>}}
 
{| class="wikitable sortable"
! <translate><!--T:61--> Description</translate>
! Name
! <translate><!--T:62--> Name</translate>
! <translate><!--T:63--> Data type</translate>
! Notes
! <translate><!--T:64--> Notes</translate>
|-
| <translate><!--T:65--> Action</translate> || <code>action</code> || <translate><!--T:66--> string</translate> || <translate><!--T:67--> One of the following:</translate> edit, move, createaccount, autocreateaccount, delete, upload<ref name="upload"><translate><!--T:68--> The only variables currently available for file uploads (<tvar|1>action='upload'</>) are <tvar|2>user_*, page_*, file_sha1, file_size, file_mime, file_mediatype, file_width, file_height, file_bits_per_channel</> (the last five were only added since the release for <tvar|3>MediaWiki 1.27 [[gerrit:281503]]</>).</translate> <translate><!--T:69--> All the <tvar|1>file_*</> variables are unavailable for other actions (including <tvar|2>action='edit'</>).</translate></ref>, stashupload<ref><translate><!--T:70--> Since <tvar|1>MediaWiki 1.28 ([[gerrit:295254]])</></translate></ref>
|-
| <translate><!--T:442--> Unix timestamp of change</translate> || <code>timestamp</code> || <translate><!--T:184--> string</translate> || <translate><!--T:185--> <tvar|1>int(timestamp)</> gives you a number with which you can calculate the date, time, day of week, etc.</translate>
|-
| {{int|abusefilter-edit-builder-vars-wiki-name}} || <code>wiki_name</code> || <translate><!--T:435--> string</translate> || <translate><!--T:436--> For instance, this is "enwiki" on the English Wikipedia, and "itwikiquote" on the Italian Wikiquote.</translate>
|-
| {{int|abusefilter-edit-builder-vars-wiki-language}} || <code>wiki_language</code> || <translate><!--T:437--> string</translate> || <translate><!--T:438--> For instance, this is "en" on the English Wikipedia, and "it" on the Italian Wikiquote. Multi-lingual wikis like Commons, Meta, and Wikidata will also report as "en".</translate>
|-
| {{int|abusefilter-edit-builder-vars-user-editcount}} || <code>user_editcount</code> || <translate><!--T:71--> integer/null</translate> || <translate><!--T:72--> Null only for unregistered users.</translate>
|-
| {{int|abusefilter-edit-builder-vars-user-name}} || <code>user_name</code> || <translate><!--T:73--> string</translate> || {{note|1=<translate><!--T:74--> For <tvar|1>"createaccount"</> and <tvar|3>"autocreateaccount"</> actions, use <tvar|2><code>accountname</code></> if you want the name of the account being created.</translate>}}
|-
| {{int|abusefilter-edit-builder-vars-user-emailconfirm}} || <code>user_emailconfirm</code> || <translate><!--T:416--> string/null</translate> || <translate><!--T:76--> In the format: YYYYMMDDHHMMSS.</translate> <translate><!--T:77--> Null if the email wasn't confirmed.</translate>
|-
| {{int|abusefilter-edit-builder-vars-user-age}} || <code>user_age</code> || <translate><!--T:78--> integer</translate> || <translate><!--T:79--> In seconds.</translate> <translate><!--T:80--> 0 for unregistered users.</translate>
|-
| {{int|abusefilter-edit-builder-vars-user-blocked}} || <code>user_blocked</code> || <translate><!--T:406--> boolean</translate> || <translate><!--T:81--> <tvar|1>True</> for blocked registered users.</translate> <translate><!--T:407--> Also true for edits from blocked IP addresses, even if the editor is a registered user who is not blocked.</translate> <translate><!--T:408--> <tvar|1>False</> otherwise.</translate> {{note|1=<translate><!--T:82--> This doesn't differentiate between partial and total blocks.</translate>}}
|-
| {{int|abusefilter-edit-builder-vars-user-groups}} || <code>user_groups</code> || <translate><!--T:83--> array of strings</translate> || <translate><!--T:84--> see <tvar|1>[[Special:ListGroupRights]]</></translate>
|-
| {{int|abusefilter-edit-builder-vars-user-rights}} || <code>user_rights</code> || <translate><!--T:85--> array of strings</translate> || <translate><!--T:86--> see <tvar|1>[[Special:ListGroupRights]]</></translate>
|-
| <span style="opacity:0.5">{{int|abusefilter-edit-builder-vars-page-id}}</span> || <span style="opacity:0.5"><code>article_articleid</code></span> || <span style="opacity:0.5"><translate><!--T:87--> integer</translate></span> || {{deprecated-inline}} <translate><!--T:88--> Use <tvar|1><code>page_id</code></> instead.</translate>
|-
| {{ll|Manual:Page_table#page_id|{{int|abusefilter-edit-builder-vars-page-id}}}} <translate><!--T:443--> (found in the page's HTML source - search for wgArticleId)</translate> || <code>page_id</code> || <translate><!--T:89--> integer</translate> || <translate><!--T:90--> In theory this is 0 for new pages, but this is unreliable.</translate> <translate><!--T:91--> If you need an exact result, use "<tvar|1>page_age == 0</>" to identify new page creation.</translate> (<translate><!--T:403--> note that it is slower, though.</translate>)
|-
| <span style="opacity:0.5">{{int|abusefilter-edit-builder-vars-page-ns}}</span> || <span style="opacity:0.5"><code>article_namespace</code></span> || <span style="opacity:0.5"><translate><!--T:92--> integer</translate></span> || {{deprecated-inline}} <translate><!--T:93--> Use <tvar|1><code>page_namespace</code></> instead.</translate>
|-
| {{int|abusefilter-edit-builder-vars-page-ns}} || <code>page_namespace</code> || <translate><!--T:94--> integer</translate> || <translate><!--T:95--> refers to {{<tvar|1>ll|Manual:Namespace#Built-in_namespaces</>|namespace index}}</translate>
|-
| {{int|abusefilter-edit-builder-vars-page-age}} || <code>page_age</code> || <translate><!--T:96--> integer</translate> || <translate><!--T:97--> the number of seconds since the first edit (or 0 for new pages).</translate> <translate><!--T:404--> This is reliable, but it tends to be slow; consider using <tvar|1><code>page_id</code></> if you don't need much precision.</translate>
|-
| <span style="opacity:0.5">{{int|abusefilter-edit-builder-vars-page-title}}</span> || <span style="opacity:0.5"><code>article_text</code></span> || <span style="opacity:0.5"><translate><!--T:98--> string</translate></span> || {{deprecated-inline}} <translate><!--T:99--> Use <tvar|1><code>page_title</code></> instead.</translate>
|-
| {{int|abusefilter-edit-builder-vars-page-title}} || <code>page_title</code> || <translate><!--T:100--> string</translate> ||
|-
| <span style="opacity:0.5">{{int|abusefilter-edit-builder-vars-page-prefixedtitle}}</span> || <span style="opacity:0.5"><code>article_prefixedtext</code></span> || <span style="opacity:0.5"><translate><!--T:101--> string</translate></span> || {{deprecated-inline}} <translate><!--T:102--> Use <tvar|1><code>page_prefixedtitle</code></> instead.</translate>
|-
| {{int|abusefilter-edit-builder-vars-page-prefixedtitle}} || <code>page_prefixedtitle</code> || <translate><!--T:103--> string</translate> ||
|-
| <span style="opacity:0.5">{{int|abusefilter-edit-builder-vars-restrictions-edit}}</span> || <span style="opacity:0.5"><code>article_restrictions_edit</code></span> || <span style="opacity:0.5"><translate><!--T:104--> string</translate></span> || {{deprecated-inline}} <translate><!--T:105--> Use <tvar|1><code>page_restrictions_edit</code></> instead.</translate>
|-
| {{int|abusefilter-edit-builder-vars-restrictions-edit}} || <code>page_restrictions_edit</code> || <translate><!--T:106--> array of strings</translate> ||
|-
| <span style="opacity:0.5">{{int|abusefilter-edit-builder-vars-restrictions-move}}</span> || <span style="opacity:0.5"><code>article_restrictions_move</code></span> || <span style="opacity:0.5"><translate><!--T:107--> string</translate></span> || {{deprecated-inline}} <translate><!--T:108--> Use <tvar|1><code>page_restrictions_move</code></> instead.</translate>
|-
| {{int|abusefilter-edit-builder-vars-restrictions-move}} || <code>page_restrictions_move</code> || <translate><!--T:109--> array of strings</translate> ||
|-
| <span style="opacity:0.5">{{int|abusefilter-edit-builder-vars-restrictions-upload}}</span> || <span style="opacity:0.5"><code>article_restrictions_upload</code></span> || <span style="opacity:0.5"><translate><!--T:110--> string</translate></span> || {{deprecated-inline}} <translate><!--T:111--> Use <tvar|1><code>page_restrictions_upload</code></> instead.</translate>
|-
| {{int|abusefilter-edit-builder-vars-restrictions-upload}} || <code>page_restrictions_upload</code> || <translate><!--T:112--> array of strings</translate> ||
|-
| <span style="opacity:0.5">{{int|abusefilter-edit-builder-vars-restrictions-create}}</span> || <span style="opacity:0.5"><code>article_restrictions_create</code></span> || <span style="opacity:0.5"><translate><!--T:113--> string</translate></span> || {{deprecated-inline}} <translate><!--T:114--> Use <tvar|1><code>page_restrictions_create</code></> instead.</translate>
|-
| {{int|abusefilter-edit-builder-vars-restrictions-create}} || <code>page_restrictions_create</code> || <translate><!--T:115--> array of strings</translate> ||
|-
| <span style="opacity:0.5">{{int|abusefilter-edit-builder-vars-recent-contributors}}</span> || <span style="opacity:0.5"><code>article_recent_contributors</code></span> || <span style="opacity:0.5">array of strings</span> || {{deprecated-inline}} <translate><!--T:116--> Use <tvar|1><code>page_recent_contributors</code></> instead.</translate>
|-
| {{int|abusefilter-edit-builder-vars-recent-contributors}} || <code>page_recent_contributors</code> || <translate><!--T:117--> array of strings</translate> || <translate><!--T:118--> This tends to be '''slow''' (see [[<tvar|1>#Performance</>|#Performance]]).</translate> <translate><!--T:119--> Try to put conditions more likely evaluate to false before this one, to avoid unnecessarily running the query.</translate> <translate><!--T:120--> This value is empty if the user is the only contributor to the page(?), and only scans the last 100 revisions</translate>
|-
| <span style="opacity:0.5">{{int|abusefilter-edit-builder-vars-first-contributor}}</span> || <span style="opacity:0.5"><code>article_first_contributor</code></span> || <span style="opacity:0.5"><translate><!--T:121--> string</translate></span> || {{deprecated-inline}} <translate><!--T:122--> Use <tvar|1><code>page_first_contributor</code></> instead.</translate>
|-
| {{int|abusefilter-edit-builder-vars-first-contributor}} || <code>page_first_contributor</code> || <translate><!--T:123--> string</translate> || <translate><!--T:124--> This tends to be '''slow''' (see [[<tvar|1>#Performance</>|#Performance]]).</translate><ref><translate><!--T:125--> Several filters (<tvar|1>[https://logstash.wikimedia.org/app/kibana#/doc/logstash-*/logstash-2017.11.22/mediawiki?id=AV_k0nzBSUnOz-leiQ1Q 1][https://logstash.wikimedia.org/app/kibana#/doc/logstash-*/logstash-2017.11.22/mediawiki?id=AV_kvnragaOKEclNGlrc 2]</>) that use this variable have showed up in the [<tvar|url>https://logstash.wikimedia.org/app/kibana#/dashboard/941a0560-b9b2-11e7-a3f7-cb9288bcae84</> AbuseFilterSlow Grafana dashboard] (requires logstash access to view).</translate> <translate><!--T:126--> Moving this variable to towards the end of the filter seemed to help.</translate></ref> <translate><!--T:127--> Try to put conditions more likely evaluate to false before this one, to avoid unnecessarily running the query.</translate>
|}
 
222

edits