User:松/Drafts/Extension:AbuseFilter/Rules format: Difference between revisions
Content added Content deleted
(→All variables: tweak file vars) |
|||
Line 47: | Line 47: | ||
{| class="wikitable sortable" |
{| class="wikitable sortable" |
||
|+ Variables available |
|+ Variables available |
||
! Description |
! Description |
||
!!! Name |
|||
!!! Data type |
|||
! |
|||
!!! Values |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-user-editcount}} |
| {{int:abusefilter-edit-builder-vars-user-editcount}} |
||
||| <code>user_editcount</code> |
|||
||| string |
|||
| |
|||
||| Empty for unregistered users. |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-user-name}} |
| {{int:abusefilter-edit-builder-vars-user-name}} |
||
||| <code>user_name</code> |
|||
||| string |
|||
| |
|||
||| |
|||
|- |
|- |
||
| |
|||
| {{int:abusefilter-edit-builder-vars-user-emailconfirm}} || <code>user_emailconfirm</code> || string || YYYYMMDDHHMMSS |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
|- |
|- |
||
| |
|||
| {{int:abusefilter-edit-builder-vars-user-age}} || <code>user_age</code> || || in seconds; 0 for IP |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-user- |
| {{int:abusefilter-edit-builder-vars-user-emailconfirm}} |
||
||| <code>user_emailconfirm</code> |
|||
||| string |
|||
| |
|||
||| YYYYMMDDHHMMSS |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-user- |
| {{int:abusefilter-edit-builder-vars-user-age}} |
||
||| <code>user_age</code> |
|||
||| |
|||
| |
|||
||| in seconds; 0 for IP |
|||
|- |
|- |
||
| |
|||
| [[Manual:Page_table#page_id|{{int:abusefilter-edit-builder-vars-article-id}}]] (found in the page's HTML source - search for wgArticleId) || <code>article_articleid</code> || integer || In theory this is 0 for new pages, but this is unreliable. Instead, use "old_size==0" to identify new page creation. |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-user-groups}} |
||
||| <code>user_groups</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-user-rights}} |
||
||| <code>user_rights</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-article- |
| [[Manual:Page_table#page_id|{{int:abusefilter-edit-builder-vars-article-id}}]] (found in the page's HTML source - search for wgArticleId) |
||
||| <code>article_articleid</code> |
|||
||| integer |
|||
| |
|||
||| In theory this is 0 for new pages, but this is unreliable. Instead, use "old_size==0" to identify new page creation. |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-article-ns}} |
||
||| <code>article_namespace</code> |
|||
||| integer |
|||
| |
|||
||| refers to [[Manual:Namespace#Built-in_namespaces|namespace index]] |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-article-text}} |
||
||| <code>article_text</code> |
|||
||| string |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-article-prefixedtext}} |
||
||| <code>article_prefixedtext</code> |
|||
||| string |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-restrictions-edit}} |
|||
| Action || <code>action</code> || string || edit, move, createaccount, autocreateaccount, delete, upload |
|||
||| <code>article_restrictions_edit</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-restrictions-move}} |
||
||| <code>article_restrictions_move</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| |
|||
| {{int:abusefilter-edit-builder-vars-minor-edit}} || <code>minor_edit</code> || string || |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
|- |
|- |
||
| |
|||
| {{int:abusefilter-edit-builder-vars-old-text}} || <code>old_wikitext</code> || || |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
|- |
|- |
||
| |
|||
| {{int:abusefilter-edit-builder-vars-new-text}} || <code>new_wikitext</code> || || |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
|- |
|- |
||
| |
|||
| {{int:abusefilter-edit-builder-vars-diff}} || <code>edit_diff</code> || || |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-recent-contributors}} |
||
||| <code>article_recent_contributors</code> |
|||
||| |
|||
| |
|||
||| Empty if the user is the only contributor to the page |
|||
|- |
|- |
||
| Action |
|||
| {{int:abusefilter-edit-builder-vars-oldsize}} || <code>old_size</code> || integer || |
|||
||| <code>action</code> |
|||
||| string |
|||
| |
|||
||| edit, move, createaccount, autocreateaccount, delete, upload |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-summary}} |
||
||| <code>summary</code> |
|||
||| string |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-minor-edit}} |
||
||| <code>minor_edit</code> |
|||
||| string |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-old-text}} |
||
||| <code>old_wikitext</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-new-text}} |
||
||| <code>new_wikitext</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-diff}} |
||
||| <code>edit_diff</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-newsize}} |
||
||| <code>new_size</code> |
|||
||| integer |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-oldsize}} |
||
||| <code>old_size</code> |
|||
||| integer |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-delta}} |
|||
| Parsed HTML source of the new revision || <code>new_html</code> || || |
|||
||| <code>edit_delta</code> |
|||
||| <!-- test this with === when edit_delta < 0 --> |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-addedlines}} |
|||
| New page text, stripped of any markup || <code>new_text</code> || || |
|||
||| <code>added_lines</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-removedlines}} |
|||
| ''Disabled'' || <code>old_html</code> || || |
|||
||| <code>removed_lines</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-all-links}} |
|||
| ''Disabled'' || <code>old_text</code> || || |
|||
||| <code>all_links</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-old-links}} |
|||
| Whether or not the change was made through a tor exit node || <code>tor_exit_node</code> || || 0, 1 |
|||
||| <code>old_links</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars-added-links}} |
|||
| Unix timestamp of change || <code>timestamp</code> || string || int(timestamp) gives you a number with which you can calculate the date, time, day of week, etc. |
|||
||| <code>added_links</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| {{int:abusefilter-edit-builder-vars- |
| {{int:abusefilter-edit-builder-vars-removed-links}} |
||
||| <code>removed_links</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|- |
||
| Parsed HTML source of the new revision |
|||
| {{int:abusefilter-edit-builder-vars-file-size}} || <code>file_size</code> || integer || The file size in bytes |
|||
||| <code>new_html</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|||
| New page text, stripped of any markup |
|||
||| <code>new_text</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|||
| ''Disabled'' |
|||
||| <code>old_html</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|||
| ''Disabled'' |
|||
||| <code>old_text</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|||
| Whether or not the change was made through a tor exit node |
|||
||| <code>tor_exit_node</code> |
|||
||| |
|||
| |
|||
||| 0, 1 |
|||
|- |
|||
| Unix timestamp of change |
|||
||| <code>timestamp</code> |
|||
||| string |
|||
| |
|||
||| int(timestamp) gives you a number with which you can calculate the date, time, day of week, etc. |
|||
|- |
|||
| {{int:abusefilter-edit-builder-vars-file-sha1}} |
|||
||| <code>file_sha1</code> |
|||
||| |
|||
| |
|||
||| |
|||
|- |
|||
| {{int:abusefilter-edit-builder-vars-file-size}} |
|||
||| <code>file_size</code> |
|||
||| integer |
|||
| |
|||
||| The file size in bytes |
|||
|} |
|} |
||
Line 468: | Line 679: | ||
|- |
|- |
||
|<code> str_replace( 'FooFoo', 'Foo', <nowiki>''</nowiki> ) == 'bar' <br /><nowiki>|</nowiki> str_replace( 'FooFoo', 'Foo', <nowiki>''</nowiki> ) == 'baz'</code>|| 9 || 1 from <code>str_replace</code> + 3 from its parameters + 1 from the first <code>==</code> + 3 for the same parameters + 1 for the second <code>==</code> |
|<code> str_replace( 'FooFoo', 'Foo', <nowiki>''</nowiki> ) == 'bar' <br /><nowiki>|</nowiki> str_replace( 'FooFoo', 'Foo', <nowiki>''</nowiki> ) == 'baz'</code>|| 9 || 1 from <code>str_replace</code> + 3 from its parameters + 1 from the first <code>==</code> + 3 for the same parameters + 1 for the second <code>==</code> |
||
|- |
|||
| |
|||
| |
|||
| |
|||
|- |
|||
| |
|||
| |
|||
| |
|||
|- |
|- |
||
|<code>str_replace( 'FooFoo', 'Foo', <nowiki>''</nowiki> )</code>|| 5 || equivalent to "<code>str_replace( 'FooFoo', 'Foo', <nowiki>''</nowiki> ) = 1</code>" |
|<code>str_replace( 'FooFoo', 'Foo', <nowiki>''</nowiki> )</code>|| 5 || equivalent to "<code>str_replace( 'FooFoo', 'Foo', <nowiki>''</nowiki> ) = 1</code>" |