User:MusikBot II/FixPP
FixPP
Adds missing protection templates and removes them after the protection expired.
![](http://upload.wikimedia.org/wikipedia/en/d/d2/Blank.png)
![check](http://upload.wikimedia.org/wikipedia/en/thumb/f/fb/Yes_check.svg/20px-Yes_check.svg.png)
To disable, set /Run to anything other than true
(link)
Errors are logged at /Error log
Configuration
Functionality can be tweaked at /config. Configuration data is in the form of JSON.
IMPORTANT:
- Do not modify the config files unless you have a basic understanding of JSON
- Read the documentation first.
- Do not change the key values.
- Keys should always be strings, e.g. use
"option": true
instead ofoption: true
. - Strings should be wrapped in double-quotes, e.g.
"option"
instead of'option'
. - Boolean values must be either
true
orfalse
with no quotations around it. - Numerical values must be integers with no quotations around it.
- The last key/value pair within a hash or the value value in an array must not have a comma at the end of it
- Essentially if the JSON editor interface says there are any syntax errors or warnings, you have done something wrong
run
Name | Description |
---|---|
remove_all_if_expired | Remove all protection templates if the page is not protected in any form, plain and simple. |
remove_individual_if_expired | Remove any individual protection templates for which there is no corresponding protection type. E.g. if the page is move-protected but not edit-protected, remove pp-blp but leave pp-move, if present, as opposed to taking no action at all. remove_all_if_expired has precedence over this option. |
auto_generate | If the bot is unable to figure out what the protection template is supposed to represent, replace it with valid auto-generated protection templates based on the current protection. E.g. if the page is edit-protected and {{pp|action=invalid_action}} is present, it will be replaced with {{pp-protected|expiry=00:00, 1 January 1970|small=yes}} (with the correct expiry). |small=yes is assumed to be desirable if no falsy value for small is provided.
|
noinclude_in_template_space | Wraps protection templates in <noinclude>...</noinclude> if the page is in the template namespace, or places it in an existing <noinclude>...</noinclude> if one is present at the very beginning of the template source.
|
remove_from_template_space_if_doc_present | Remove protection templates from pages in the template namespace if the page contains {{documentation}} (or any of it's redirects) or {{collapsible option}} (or any of it's redirects), as these templates automatically generate the padlock icon. |
normalize_pp_template | Normalize usage of {{pp}}. E.g. {{pp|sock|expiry=January 1, 1970}} will be converted to {{pp-sock|expiry=00:00, 1 January 1970}}. Strips out usage of non-critical parameters such as |user= , |section= , |category= , etc., as these may not be supported in the normalized template.
|
base_protection_templates
The bot's ability to handle all types of protection templates depends on it knowing what the core templates are, from which it collects all of their redirects. The base_protection_templates hash specifies each of these templates, none of which are redirects, and their type of protection. For example, {{pp-semi-BLP}} redirects to {{pp-blp}}, and pertains only to edit protection, as opposed to {{pp-move}} which pertains to move protection.
There is, or should only be, a single template that can represent multiple types of protection, which is {{pp}}. For this, the corresponding value in the hash is an empty string. If another key is added to the has with an empty string value it will be treated and parsed the same way {{pp}} is. Note many templates redirect here, such as {{pp-protected}}.
This set of templates and their types should very rarely change. It should more or less match the table at Template:Protection templates, with some important exceptions.
IMPORTANT:
Some protection templates are deliberately left out. These include:
- {{permanently protected}} and {{temporarily protected}} – These are edge cases and are used on talk pages that are not themselves protected, rather the accompanying subject page is protected. The bot is not programmed to try to fix invalid usage of these templates.
- {{pp-office}}, {{pp-reset}}, {{pp-office-dmca}} – These are added by WMF staff as office actions. Removing the templates even after the protection has expired should not be left to the bot.
- {{pp-main-page}}, {{mprotected2}}, etc – These are added as a result of the pages being transcluded on the Main Page. Another bot automates adding and removing these.
config
Name | Description |
---|---|
small_values | Valid truthy values that can be passed to |small= in protection templates
|
pp_reasons | List of reasons from Template:Pp#Reasons that can be mapped to their own template. E.g. {{pp|sock}} can be normalized to {{pp-sock}}. See info on core templates above, as some are deliberately excluded such as "mainpage" and "office" |