Content deleted Content added
Updating published sources: AnomieBOT::API: * Change connectToReplica() for Tool Forge changes. BrokenRedirectDeleter: * Stop using a temporary table, since the new Tool Forge DBs don't support it anymore. |
Updating published sources: EnDashRedirectCreator: * Copy fragment when bypassing double redirects. |
||
Line 135:
my $from = $to;
$from =~ s/–/-/g;
$redirects{$from} = [ $to, $to, undef ];
}
Line 150:
my %map = ();
if ( exists($res->{'query'}{'normalized'} ) ) {
$map{$_->{'from'}} = [ $_->{'to'}, $_->{'tofragment'} // undef ] foreach @{$res->{'query'}{'normalized'}};
}
if ( exists($res->{'query'}{'redirects'} ) ) {
$map{$_->{'from'}} = [ $_->{'to'}, $_->{'tofragment'} // undef ] foreach @{$res->{'query'}{'redirects'}};
}
my %exists = ();
Line 162:
}
while( my ($redir, $targets) = each( %redirects ) ) {
my ($origtarget, $target, $fragment) = @$targets;
my %seen=( $target => 1 );
while ( exists( $map{$target} ) ) {
$
$
$redirects{$redir} = [ $origtarget, $target, $fragment ];
if ( exists( $seen{$target} ) ) {
$api->warn("Redirect loop involving [[$target]]");
Line 181 ⟶ 182:
return 0 if $api->halting;
my ($origtarget, $target, $fragment) = @$targets;
my $tok=$api->edittoken($redir, EditRedir => 1, imageinfo => { prop => '', limit => 1 });
Line 233 ⟶ 234:
}
$target .= '#' . $fragment if defined( $fragment );
my $txt = "#REDIRECT [[:$target]]\n{{Redirect shell|{{R from modification|1={{-r|$origtarget}}}}}}\n{{User:AnomieBOT/Auto-G8|target=$origtarget}}";▼
my $tosection = defined( $fragment ) ? '{{R to section}}' : '';
▲ my $txt = "#REDIRECT [[:$target]]\n{{Redirect shell|{{R from modification|1={{-r|$origtarget}}}}$tosection}}\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;
|