Jump to content

User:CX Zoom AWB/Task 1

From Wikipedia, the free encyclopedia
CX Zoom AWB/ Task 1
Description Fix errors in code due to substitution of a template
BRFA Wikipedia:Bots/Requests for approval/CX Zoom AWB
Status  Completed
Frequency Non-recurring
Type AWB, Manual
Edits made 1519 (list)
Last run 19 July 2023 (diff)

Background

[edit]

Due to an error at Template:Uw-username, the following code appeared

{{#ifeq:{{NAMESPACENUMBER}}|3|{{#ifeq:{{ROOTPAGENAME}}|{{ROOTPAGENAME:}}[[Category:Pages which use a template in place of a magic word|S{{PAGENAME}}]]|[[Category:Wikipedia usernames with possible policy issues|{{PAGENAME}}]]}}}}

The actual markup that should have appeared is:

{{#ifeq:{{NAMESPACENUMBER}}|3|{{#ifeq:{{ROOTPAGENAME}}|<username at the time of subst>|[[Category:Wikipedia usernames with possible policy issues|{{PAGENAME}}]]}}}}

There was another issue with the tempalate with this edit, where due to extra safesubst, the #ifeq check between current username & username at the time of subst was removed and Category:Wikipedia usernames with possible policy issues permanently became a part of that page.

Process

[edit]

There are two parts to this task:

  1. To find the pages with erroneous markup, and fix them up.
    • Completed
  2. To find the pages with Category:Wikipedia usernames with possible policy issues permanently embedded, and fix them up.

Resources

[edit]

Regex

[edit]

To fix the type 1 pages, the following regex was employed:

Regex mode: multiline
Find:
your\susername,\s"'''(.*)'''",([\S\s]*)\{\{#ifeq:\{\{NAMESPACENUMBER\}\}\|3\|\{\{#ifeq:\{\{ROOTPAGENAME\}\}\|\{\{ROOTPAGENAME:\}\}\[\[Category:Pages which use a template in place of a magic word\|S\{\{PAGENAME\}\}\]\]\|\[\[Category:Wikipedia usernames with possible policy issues\|\{\{PAGENAME\}\}\]\]\}\}\}\}
Replace:
your username, "'''$1'''",$2{{#ifeq:{{NAMESPACENUMBER}}|3|{{#ifeq:{{ROOTPAGENAME}}|$1|[[Category:Wikipedia usernames with possible policy issues|{{PAGENAME}}]]}}}}

Errors

[edit]

Two errors were caused due to greedy matches employed by the regex. Both pages had multiple substitutions of {{uw-username}}. The regex matched the username in the first substitutions, and went straight to the last substitution and applied the caught username there.

  1. Special:Diff/1144335591/1166149759 on User talk:DyvlusYaNaNebo98 was later fixed manually
  2. Special:Diff/1163369439/1166149261 on User talk:R&B Fan did not need to be fixed

Potential fix can be found here: https://stackoverflow.com/a/11899069/19968976

[edit]