Jump to content

User:JJMC89 bot III/tasks/CFDW

This user has administrator privileges on the English Wikipedia.
This user is a bot.
This bot is hosted on Toolforge.
From Wikipedia, the free encyclopedia

This task processes WP:CFD closes that are listed at WP:CFD/W and WP:CFD/W/L.

Process

[edit]
  • The working page must have full (sysop) edit protection.
  • The bot can only recategorize when a page is categorized using category syntax ([[Category:Foo]]).
  1. The bot iterates over each section of the page using the section header to determine the mode.
  2. Within a section the bot iterates over each line if wikitext.
    • Each line consists of three parts: prefix, wikilinks/templates, and suffix. Everything else is ignored.
      • All wikilinks on the line
        • They must be to a CfD page or a category. The bot will not process the rest of the section if any other wikilink is found.
        • If a CfD link does not contain a section, the bot will attempt figure it out based on the linked CfD page.
      • Configured templates (#Templates) can be used to link categories. All other templates are ignored.
      • The prefix is the plain text at the beginning of the line.
        • The prefix on a line with a CfD link applies to all lines until the next CfD link.
        • If the prefix contains "NO BOT" (case sensitive), the bot will not queue it. (These should be placed on WP:CFD/W/M instead.)
      • The suffix is the plain text at the end of the line.
        • The suffix on a line with a CfD link applies to all lines until the next CfD link unless that line has a suffix.
  3. If a CfD link was found and there is at least one category link is on the line, the bot will queue the request.
  4. After queueing the entire page, the bot will remove any conflicting requests and requests involving disambiguation categories from the queue and then check and process the remaining requests.

Templates

[edit]

The template configuration is User:JJMC89 bot III/config/CFDW/templates.json.

The configuration contains two keys.

  • cfd – category templates recognized as an alternative to category wikilinks on WP:CFDW and in CFD discussions
  • update – templates that are updated when recategorizing pages

Each of those keys contains an array of objects with up to two keys.

  • title – name of the template
    • Redirects are automatically detected.
  • params – python regular expression for the name of the parameters that may be updated
    • Does not apply to cfd – first unnamed parameter is always used
    • Optional for update – any parameter when unspecified

Empty mode

[edit]
  • The bot removes the category from all pages and deletes the empty category.
  • Checks:
    • There must be one category on the line.

Merge mode

[edit]
  • The bot merges the category to one or more target categories and deletes the empty category.
  • If the prefix contains "REDIRECT" (case sensitive) and there is a single merge target, then the bot will redirect the category to the target using {{category redirect}} instead of deleting it and add {{old CfD}} to the talk page.
  • Checks:
    • The current category cannot be a merge target.
    • There must be one or more merge targets on the line.
    • All merge targets must exist and not be a redirect.

Move mode

[edit]
  • The bot moves the category to a target category without leaving a redirect and removes the {{cfx full}} template.
  • If the prefix contains "REDIRECT" (case sensitive), then the bot will leave a redirect.
  • Checks:
    • The current category cannot be the move target.
    • There must be one move target on the line.
    • If the current category is a redirect, then the target must exist.
    • The target must not be a redirect.

Retain mode

[edit]
  • The bot removes the {{cfx full}} template and adds {{old CfD}} to the talk page.
  • If the suffix does not contain the discussion action and result for {{old CfD}}, the bot will attempt figure them out based on the linked CfD page.
  • On the working page, the action/result must be one of the following.
    • no consensus (for|to) action
    • not action
    • keep (The action is assumed to be delete.)
  • Checks:
    • There must be one category on the line.
    • There must be an action and result (on the line or bot detected).