Content deleted Content added
Updating published sources: EnDashRedirectCreator: * Detect edit warring on the redirects. AnomieBOT and Bot1058 can easily get into conflict if the en-dashed subject page is a redirect and its talk page does not match. |
Updating published sources: EnDashRedirectCreator: * If there are multiple dashed talk page titles with conflicting targets, and one matches its subject page while the other doesn't, prefer the matching one. Probably the non-matching talk page is because someone thinks discusson of the subject-space redirect needs to be preserved on that specific talk page (rather than being archived to the target's talk page) so they refuse to redirect it. |
||
Line 99:
my %ns = $api->namespace_map();
my %rns = $api->namespace_reverse_map();
my $nsre = $api->namespace_re(qw/! 0/);
my ($dbh);
Line 225 ⟶ 226:
my ($redir, $origtarget, $target, $fragment) = @$targets;
my $redirNs = ( $redir =~ /^([^:]+):/ && exists( $ns{$1} ) ? $ns{$1} : 0 );▼
my $targetNs = ( $target =~ /^([^:]+):/ && exists( $ns{$1} ) ? $ns{$1} : 0 );▼
my $tok=$api->edittoken($redir, EditRedir => 1, imageinfo => { prop => '', limit => 1 });
Line 256 ⟶ 260:
$tmp =~ s/[$dashstr]/-/gu;
if ( $tmp eq $redir ) {
my ( $oldtargetSubj, $origtargetSubj );
( $origtargetSubj = $origtarget ) =~ s/^$nsre:/$subjNsPrefix/;
( $oldtargetSubj = $oldtarget ) =~ s/^$nsre:/$subjNsPrefix/;
my %tgts = $api->resolve_redirects( $origtargetSubj, $oldtargetSubj, $origtarget, $oldtarget );
my ($oldsubjtgt, $oldtalktgt, $origsubjtgt, $origtalktgt);
$oldsubjtgt = $tgts{$oldtargetSubj};
( $oldtalktgt = $tgts{$oldtarget} ) =~ s/^($nsre):/ $ns{$1} > 1 ? "$rns{$ns{$1} & ~1}:" : '' /e;
$origsubjtgt = $tgts{$origtargetSubj};
( $origtalktgt = $tgts{$origtarget} ) =~ s/^($nsre):/ $ns{$1} > 1 ? "$rns{$ns{$1} & ~1}:" : '' /e;
if ( $oldsubjtgt eq $oldtalktgt && $origsubjtgt ne $origtalktgt ) {
$api->log("Skipping [[$origtarget]], [[$redir]] already exists for [[$oldtarget]] and [[$oldtargetSubj]] matches that while [[$origtarget]] does not match [[$origtargetSubj]]");
next;
} elsif ( $oldsubjtgt ne $oldtalktgt && $origsubjtgt eq $origtalktgt ) {
$api->warn("Updating [[$redir]] to [[$target]]: [[$redir]] already exists for [[$oldtarget]], but that does not match [[$oldtargetSubj]] while [[$origtarget]] does match [[$origtargetSubj]]");
} else {
$api->warn("[[$redir]]
next;
}
} else {
$api->warn("[[$redir]] apparently exists for both [[$oldtarget]] and [[$origtarget]], not updating");
next;
}
} else {
$api->warn("[[$redir]] claims to exist for [[$oldtarget]], but that's not valid so overwriting");
}
▲ $api->warn("[[$redir]] claims to exist for [[$oldtarget]], but that's not valid so overwriting");
}
}
Line 266 ⟶ 296:
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 ) ) {
|