User:CX Zoom AWB/Task 1
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:
- To find the pages with erroneous markup, and fix them up.
- Completed
- To find the pages with Category:Wikipedia usernames with possible policy issues permanently embedded, and fix them up.
- No such page remained, see #Resouces
Resources
[edit]- Special:Permalink/1163847075#Fixing of categorisation error caused by error in uw template (list of pages, type 1; by Qwerfjkl)
- Special:Permalink/1166153664#Learning to search (making better searches; by Qwerfjkl)
- Special:Permalink/1167393910#Wikitext searching query (searching for list of pages, type 2; by Certes)
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.
- Special:Diff/1144335591/1166149759 on User talk:DyvlusYaNaNebo98 was later fixed manually
- 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