Jump to content

Abuse filter management

Differences between versions

ItemVersion from 08:33, 1 November 2025 by AnotherConsumerRightsPersonVersion from 18:35, 9 December 2025 by AnotherConsumerRightsPerson
Basic information
Notes:
# AnotherConsumerRightsPerson - Have disabled due to Filter 4 being the same thing but better, and this takes up time to run, but enable again if I'm wrong.
# AnotherConsumerRightsPerson (10 November 2025) - Have disabled due to Filter 4 being the same thing but better, and this takes up time to run, but enable again # if I'm wrong.
# AbuseFilter Rule: Restrict Removal of Stub Notices to Sysops Only
# AbuseFilter Rule: Restrict Removal of Stub Notices to Sysops Only
#  
#  
# Description:
# Description:
# This is an AbuseFilter rule for MediaWiki that prevents regular users and anonymous editors  
# This is an AbuseFilter rule for MediaWiki that prevents regular users and anonymous editors  
# from removing specific stub notices (`{{irrelevant}}`, `{{incomplete}}`, `{{garbage}}`) from articles.
# from removing specific stub notices (`{{irrelevant}}`, `{{incomplete}}`, `{{garbage}}`) from articles.
# Only users in the "sysop" (administrator) group are allowed to remove these notices.
# Only users in the "sysop" (administrator) group are allowed to remove these notices.
# The purpose of this rule is to ensure that these warnings remain in place until reviewed  
# The purpose of this rule is to ensure that these warnings remain in place until reviewed  
# and removed by a moderator so people don't get salty and remove notices from their own articles. They can edit the article but can't remove the notice.  
# and removed by a moderator so people don't get salty and remove notices from their own articles. They can edit the article but can't remove the notice.  
#  
#  
# Rule Syntax:
# Rule Syntax:
# The rule uses MediaWiki's AbuseFilter language, which operates on conditions and actions.  
# The rule uses MediaWiki's AbuseFilter language, which operates on conditions and actions.  
# Here is the full rule with comments explaining each part:
# Here is the full rule with comments explaining each part:


(
(
     # `contains_any` checks if any of the specified strings (stub templates) were removed in the edit.
     # `contains_any` checks if any of the specified strings (stub templates) were removed in the edit.
     contains_any(removed_lines, "{{irrelevant}}", "{{incomplete}}", "{{garbage}}")
     contains_any(removed_lines, "{{irrelevant}}", "{{incomplete}}", "{{garbage}}")
) &  
) &  
!(
!(
     # `user_groups contains "sysop"` ensures the rule applies only to users who are NOT sysops.
     # `user_groups contains "sysop"` ensures the rule applies only to users who are NOT sysops.
     user_groups contains "sysop"
     user_groups contains "sysop"
)
)


# How the Rule Works:
# How the Rule Works:
# 1. The `removed_lines` variable holds the content removed in an edit.
# 1. The `removed_lines` variable holds the content removed in an edit.
# 2. `contains_any(removed_lines, "{{irrelevant}}", "{{incomplete}}", "{{garbage}}")`:
# 2. `contains_any(removed_lines, "{{irrelevant}}", "{{incomplete}}", "{{garbage}}")`:
#    - Checks if any of the three templates were part of the removed content.
#    - Checks if any of the three templates were part of the removed content.
#    - If yes, this part evaluates to true.
#    - If yes, this part evaluates to true.
# 3. `user_groups contains "sysop"`:
# 3. `user_groups contains "sysop"`:
#    - Checks if the user making the edit belongs to the "sysop" group.
#    - Checks if the user making the edit belongs to the "sysop" group.
#    - The `!` (NOT) operator ensures the rule applies to users who are NOT in the "sysop" group.
#    - The `!` (NOT) operator ensures the rule applies to users who are NOT in the "sysop" group.
# 4. The rule triggers if:
# 4. The rule triggers if:
#    - The edit removes one or more of the stub notices, AND
#    - The edit removes one or more of the stub notices, AND
#    - The editor is not a sysop.
#    - The editor is not a sysop.


# Actions to Take:
# Actions to Take:
# You can configure the following actions for this rule:
# You can configure the following actions for this rule:
# - **Disallow**: Prevent the edit entirely.
# - **Disallow**: Prevent the edit entirely.
# - **Warn**: Show a message to the user explaining why their edit is disallowed.
# - **Warn**: Show a message to the user explaining why their edit is disallowed.
# - **Tag**: Mark the edit for review by admins.
# - **Tag**: Mark the edit for review by admins.
# - Typically, "Disallow" is sufficient for this scenario.
# - Typically, "Disallow" is sufficient for this scenario.


# Example Warning Message:
# Example Warning Message:
# "You are not allowed to remove the stub notices {{irrelevant}}, {{incomplete}}, or {{garbage}} unless you are a sysop. Please contact an administrator if you believe this is a mistake."
# "You are not allowed to remove the stub notices {{irrelevant}}, {{incomplete}}, or {{garbage}} unless you are a sysop. Please contact an administrator if you believe this is a mistake."


# Editing This Rule:
# Editing This Rule:
# For a newbie with no coding experience:
# For a newbie with no coding experience:
# 1. Log in as a user with permission to modify AbuseFilters (usually sysop or higher).
# 1. Log in as a user with permission to modify AbuseFilters (usually sysop or higher).
# 2. Go to `Special:AbuseFilter` and find this rule.
# 2. Go to `Special:AbuseFilter` and find this rule.
# 3. Edit the rule as follows:
# 3. Edit the rule as follows:
#    - To add new stub templates, include them in the `contains_any` function, like this:
#    - To add new stub templates, include them in the `contains_any` function, like this:
#      contains_any(removed_lines, "{{irrelevant}}", "{{incomplete}}", "{{garbage}}", "{{new_template}}")
#      contains_any(removed_lines, "{{irrelevant}}", "{{incomplete}}", "{{garbage}}", "{{new_template}}")
#    - To change who can remove stub notices, modify the `user_groups` condition:
#    - To change who can remove stub notices, modify the `user_groups` condition:
#      Example: `!(user_groups contains "superadmin")` will restrict removal to superadmins only.
#      Example: `!(user_groups contains "superadmin")` will restrict removal to superadmins only.
# 4. Save the filter and test it using the "Test" feature to ensure it behaves as expected.
# 4. Save the filter and test it using the "Test" feature to ensure it behaves as expected.


# Testing the Rule:
# Testing the Rule:
# - Use the "Test" feature on the AbuseFilter management page.
# - Use the "Test" feature on the AbuseFilter management page.
# - Input sample edits (removed lines with stub templates) and check if the rule triggers correctly.
# - Input sample edits (removed lines with stub templates) and check if the rule triggers correctly.
# - Test edits as a sysop and a non-sysop to confirm that permissions work properly.
# - Test edits as a sysop and a non-sysop to confirm that permissions work properly.


# Notes for Maintenance:
# Notes for Maintenance:
# - Keep the warning message clear and user-friendly.
# - Keep the warning message clear and user-friendly.
# - Log attempts to remove these templates for audit purposes.
# - Log attempts to remove these templates for audit purposes.
# - Review the filter regularly to ensure it is functioning as intended.
# - Review the filter regularly to ensure it is functioning as intended.