User:AnomieBOT/source/tasks/TemplateReplacer5.pm

parameter to the WikiProject Video games template instead. Unfortunately, this page already uses all three of,  , and   in its WikiProject Video games, so human intervention is required. ~";                           $summary="/* Template:$template removal issue */ Human intervention needed to replace  with ";                            $minor=0;                        }                    }                    if($has_SonicTF){                        my @tf=grep(/^\s*tf[23]?\s*=\s*Sonic\s*$/, @params);                        if(!@tf){                            if(!grep(/^\s*tf\s*=/, @params)){                                push @params, "tf=Sonic";                            } elsif(!grep(/^\s*tf2\s*=/, @params)){                                push @params, "tf2=Sonic";                            } elsif(!grep(/^\s*tf3\s*=/, @params)){                                push @params, "tf3=Sonic";                            } else {                                $append="\n==Template:$template removal issue==\nPer $req, I am going through all pages transcluding $template to remove it and add a   parameter to the WikiProject Video games template instead; I am also copying the   parameter, if it was present. Unfortunately, this page already uses  and   in its WikiProject Video games (keeping both Sega and Sonic task forces requires at least two free   parameters), so human intervention is required. ~";                               $summary="/* Template:$template removal issue */ Human intervention needed to replace  with ";                                $minor=0;                            }                        }                    }

# Canonicalize name $oname=~s/\Q$name\E/WikiProject Video games/i;

# Ok, return the new template code now. return ""; });               $outtxt.=$append;

# Need to edit? if($outtxt ne $intxt){ # Post-process to fix # WikiProjectBanners/WikiProjectBannerShell numbering. $outtxt=$self->process_templates($outtxt, sub {                       my $name=shift;                        my @params=@{shift};                        shift; # $wikitext                        shift; # $data                        my $oname=shift;

$name=~s/_/ /g; return undef unless exists($WPB{'Template:'.ucfirst($name)}); my $idx=0; my $out=''; return (@params<=1)?undef:$out; });

$self->warn("$summary in $title\n"); my $r=$api->edit($tok, $outtxt, $summary, $minor, $minor); if($r->{'code'} ne 'success'){ $self->warn("Write failed on $title: ".$r->{'error'}."\n"); next; }               } else { $self->warn("Nothing to do in $title\n"); }

# If we've been at it long enough, let another task have a go. return 0 if time>=$endtime; }       } while(exists($q{'eicontinue'})); }

# No more pages to check, try again in 10 minutes or so in case of errors. return 600; }

1;