Content deleted Content added
Updating published sources: AFDMergeFromCleaner: * Bah, the "nextrun" variable wasn't being loaded correctly. Fix that. |
Updating published sources: AFDMergeFromCleaner: * Bah, the "nextrun" variable wasn't being loaded correctly. Fix that. * Also, trim "|}" from the end of the last table entry when parsing them. * And don't update the report with incomplete data. |
||
Line 207:
}
if($ret==21600){ # No error above
$self->warn("Task disabled: ".$tok->{'content'}."\n");
return 300;
}
if($tok->{'code'} ne 'success'){ $self->warn("Failed to get edit token for $report: ".$tok->{'error'}."\n");
$ret=60;
last;
}
my $intxt=exists($tok->{'revisions'}[0]{'*'})?$tok->{'revisions'}[0]{'*'}:'';
foreach my $s (split(/(?=(?:^|\n)==)/, $intxt)){
if($s=~/^==\s*Redirected\s*==/){
foreach (split /\n\|-\n/, $s){
next unless /^\Q| {{$linktmpl|\E([^]]+)\Q}} || {{$linktmpl|\E([^]]+)\Q}} || {{$linktmpl|\E([^]]+)\Q}} ||/; next unless exists($redirected{"$1>$2>$3"});
$redirected{"$1>$2>$3"}=$_;
}
} elsif($s=~/^==\s*Deleted\s*==/){
foreach (split /\n\|-\n/, $s){
next unless /^\Q| {{$linktmpl|\E([^]]+)\Q}} || {{$linktmpl|\E([^]]+)\Q}} ||/; $deleted{"$1>$2"}=$_;
}
}
}
my $outtxt="== Redirected ==\n";▼
$outtxt.="The following table lists pages referred to by {{tl|afd-mergefrom}} are redirects to some page other than that with the {{tl|afd-mergefrom}}. Please correct the {{tl|afd-mergefrom}}, either by removing it (if the page was correctly merged elsewhere), undoing the incorrect redirection, or pointing it to the correct page. This table will be updated automatically.\n\n";▼
▲ my $outtxt="== Redirected ==\n";
$outtxt.="{| class=\"wikitable sortable\"\n";
▲ $outtxt.="The following table lists pages referred to by {{tl|afd-mergefrom}} are redirects to some page other than that with the {{tl|afd-mergefrom}}. Please correct the {{tl|afd-mergefrom}}, either by removing it (if the page was correctly merged elsewhere), undoing the incorrect redirection, or pointing it to the correct page. This table will be updated automatically.\n\n";
$outtxt.="
$outtxt.="
$outtxt.=join("\n|-\n", sort values %redirected);
$outtxt.=
$outtxt.="
$outtxt.="The following table lists deleted pages that were referred to by {{tl|afd-mergefrom}}; the offending {{tl|afd-mergefrom}} has already been removed. Please double-check whether the deletion was correct. If so, just remove the row from the table; if not, undelete the page and restore the {{tl|afd-mergefrom}}. This table will '''not''' be updated automatically.\n\n";▼
$outtxt.="{| class=\"wikitable sortable\"\n";
▲ $outtxt.="The following table lists deleted pages that were referred to by {{tl|afd-mergefrom}}; the offending {{tl|afd-mergefrom}} has already been removed. Please double-check whether the deletion was correct. If so, just remove the row from the table; if not, undelete the page and restore the {{tl|afd-mergefrom}}. This table will '''not''' be updated automatically.\n\n";
$outtxt.="
$outtxt.="
$outtxt.=join("\n|-\n", sort values %deleted);
$outtxt.=
if($outtxt ne $intxt){
my $summary="Updating list of non-matching merges";
$self->warn("$summary in $report\n");
my $r=$api->edit($tok, $outtxt, $summary.$screwup, 1, 1);
if($r->{'code'} ne 'success'){
$self->warn("Write failed on $report: ".$r->{'error'}."\n");
$ret=60;
}
}
}
|