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

Line 561:
When <code>action='move'</code>,only the <code>summary</code>,<code>action</code>,<code>timestamp</code> and <code>user_*</code> variables are available.The <code>page_*</code> variables are also available, but the prefix is replaced by <code>moved_from_</code> and <code>moved_to_</code>, that represent the values of the original article name and the destination one, respectively.For example, <code>moved_from_title</code> and <code>moved_to_title</code> instead of <code>page_title</code>.
 
Since MediaWiki 1.28 ([[mw:gerrit:295254|gerrit:295254]]), <code>action='upload'</code> is only used when publishing an upload, and not for uploads to stash.A new <code>action='stashupload'</code> is introduced, which is used for all uploads, including uploads to stash.This behaves like <code>action='upload'</code> used to, and only provides file metadata variables (<code>file_*</code>).Variables related to the page edit, including <code>summary</code>, <code>new_wikitext</code> and several others, are now available for <code>action='upload'</code>.For every file upload, filters may be called with <code>action='stashupload'</code> (for uploads to stash), and are always called with <code>action='upload'</code>; they are not called with <code>action='edit'</code>.
<translate>
<!--T:269-->
A new <tvar|1><code>action='stashupload'</code></> is introduced, which is used for all uploads, including uploads to stash.</translate>
<translate>
<!--T:270-->
This behaves like <tvar|1><code>action='upload'</code></> used to, and only provides file metadata variables (<tvar|2><code>file_*</code></>).</translate>
<translate>
<!--T:271-->
Variables related to the page edit, including <tvar|1><code>summary</code></>, <tvar|2><code>new_wikitext</code></> and several others, are now available for <tvar|3><code>action='upload'</code></>.</translate>
<translate>
<!--T:272-->
For every file upload, filters may be called with <tvar|1><code>action='stashupload'</code></> (for uploads to stash), and are always called with <tvar|2><code>action='upload'</code></>; they are not called with <tvar|3><code>action='edit'</code></>.
 
Filter authors should use <tvar|1><code>action='stashupload' | action='upload'</code></> in filter code when a file can be checked based only on the file contents – for example, to reject low-resolution files – and <tvar|2><code>action='upload'</code></> only when the wikitext parts of the edit need to be examined too – for example, to reject files with no description.</translate>This will allow tools that separate uploading the file and publishing the file (e.g. [[mw:UploadWizard|UploadWizard]] or [[mw:upload dialog|upload dialog]]) to inform the user of the failure before they spend the time filling in the upload details.
<!--T:273-->
Filter authors should use <tvar|1><code>action='stashupload' | action='upload'</code></> in filter code when a file can be checked based only on the file contents – for example, to reject low-resolution files – and <tvar|2><code>action='upload'</code></> only when the wikitext parts of the edit need to be examined too – for example, to reject files with no description.</translate>
<translate>
<!--T:274-->
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.
</translate>
 
{{anchor|Performance}}
222

edits