Content deleted Content added
Updating published sources: EnDashRedirectCreator: * Don't create redirects that shadow pages on Commons. |
Updating published sources: EnDashRedirectCreator: * Don't create redirects that would be eligible for WP:CSD#R2. |
||
Line 37:
2302, 2303, # Gadget definition, probably doesn't use normal redirects
2600, 2601, # Topic, probably doesn't use normal redirects
);
my %crossNsOk = (
0 => 1, # Not actually cross
4 => 1, # Wikipedia, not eligible for CSD:R2
10 => 1, # Template, not eligible for CSD:R2
12 => 1, # Help, not eligible for CSD:R2
14 => 1, # Category, not eligible for CSD:R2
100 => 1, # Portal, not eligible for CSD:R2
);
Line 63 ⟶ 72:
my $screwup=' Errors? [[User:'.$api->user.'/shutoff/EnDashRedirectCreator]]';
my %ns = $api->namespace_map();
my %rns = $api->namespace_reverse_map();
Line 171 ⟶ 181:
if ( exists( $tok->{'imagerepository'} ) && $tok->{'imagerepository'} ne '' ) {
$api->log("$redir is an existing image (repo=$tok->{imagerepository}), skipping");
next;
}
my $redirNs = ( $redir =~ /^(.+):/ && exists( $ns{$1} ) ? $ns{$1} : 0 );
my $targetNs = ( $target =~ /^(.+):/ && exists( $ns{$1} ) ? $ns{$1} : 0 );
if ( $redirNs == 0 && !( $crossNsOk{$targetNs} // 0 ) ) {
$api->log("$redir to $target would be a cross-namespace redirect, skipping");
next;
}
if ( $redirNs == 1 && !( $crossNsOk{$targetNs & ~1} // 0 ) ) {
$api->log("$redir to $target is the talk page of what would be a cross-namespace redirect, skipping");
next;
}
|