User:AnomieBOT/source/tasks/EnDashRedirectCreator.pm: Difference between revisions

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: EnDashRedirectCreator: * Apply {{tlu|User:AnomieBOT/Auto-G8}} to created redirects.
AnomieBOT (talk | contribs)
Updating published sources: EnDashRedirectCreator: * Add a skip list so certain titles that shouldn't be created won't spam the logs. * Don't even try to resolve redirects for "Template:Editnotices/*". * Fix invocation of {{tl|R from modification}}, pa...
Line 37:
2302, 2303, # Gadget definition, probably doesn't use normal redirects
2600, 2601, # Topic, probably doesn't use normal redirects
);
 
# Titles that the bot can't and shouldn't create redirects for, to avoid logspam.
my %skipTitles = (
0 => {
"List_of_''Late_Night_with_Jimmy_Fallon''_episodes_(2013–14)" => 1,
},
6 => {
"Velázquez_–_Bufón_don_Sebastián_de_Morra_(Museo_del_Prado,_c._1645).jpg" => 1,
},
10 => {
"Location_map_Minneapolis–Saint_Paul" => 1,
},
);
 
Line 114 ⟶ 127:
for my $row (@rows) {
utf8::decode( $row->{'title'} ); # Data from database is binary
 
next if exists( $skipTitles{$row->{'ns'} & ~1}{$row->{'title'}} );
next if $row->{'ns'} == if10 (&& $redirrow->{'title'} =~ m!^Template:Editnotices/! ) {;
 
my $to = ( $row->{'ns'} ? $rns{$row->{'ns'}} . ':' : '' ) . $row->{'title'};
$to =~ s/_/ /g;
Line 211 ⟶ 228:
}
if ( exists( (values %{$res->{'query'}{'pages'}} )[0]{'missing'} ) ) {
#$api->log("File talk page redirect [[$redir]] -> [[$target]] has no corresponding target file page, skipping");
next;
}
}
 
my $txt = "#REDIRECT [[:$target]]\n{{Redirect shell|{{R from modification|p11={{-r|$origtarget}}}}}}\n{{User:AnomieBOT/Auto-G8|target=$origtarget}}";
if ( $redir =~ m!^Template:Editnotices/! ) {
#$api->log("Redirect [[$redir]] -> [[$target]] is blacklisted by the title blacklist, skipping");
next;
}
 
my $txt = "#REDIRECT [[:$target]]\n{{Redirect shell|{{R from modification|p1={{-r|$origtarget}}}}}}\n{{User:AnomieBOT/Auto-G8|target=$origtarget}}";
my $summary="Redirecting to [[:$origtarget]] because titles with en-dashes are hard to type";
$summary.=" (and resolving the double redirect to [[:$target]])" if $origtarget ne $target;