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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: PUICloser: * Approved! AFDMergeFromCleaner: * Add handling of deleted pages * Clean up reporting code * Run to completion each time.
AnomieBOT (talk | contribs)
Updating published sources: AFDMergeFromCleaner: * Approved! * Use a link template for the report table, so the various pages have useful links associated. * Bugfix in parsing the report page.
Line 1:
{{ombox|type=notice|text= ApprovalApproved requested 20082009-1201-2903<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 20]]}}
<source lang="perl">
package tasks::AFDMergeFromCleaner;
Line 9:
Task: AFDMergeFromCleaner
BRFA: Wikipedia:Bots/Requests for approval/AnomieBOT 20
Status: BRFAApproved 2009-01-03
Rate: Max 6 edits/minute
 
Line 38:
 
=for info
ApprovalApproved requested 20082009-1201-2903<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 20]]
 
=cut
 
sub approved {
return 02;
}
 
Line 82:
my %deleted=();
my $ret=21600;
 
my $linktmpl='User:'.$api->user.'/la';
 
MAINLOOP:
Line 167 ⟶ 169:
$remove{$f}=1;
} else {
$redirected{"$f>$subject>$t"}="| [[:{{$linktmpl|$f]]}} || [[:{{$linktmpl|$subject]]}} || [[:{{$linktmpl|$t]]}} || \n";
}
}
Line 177 ⟶ 179:
$f=$norm{$f} if exists($norm{$f});
$remove{exists($norm{$f})?$norm{$f}:$f}=1;
$deleted{"$f>$subject"}="| [[:{{$linktmpl|$f]]}} || [[:{{$linktmpl|$subject]]}} || \n";
}
}
Line 217 ⟶ 219:
my $intxt=exists($tok->{'revisions'}[0]{'*'})?$tok->{'revisions'}[0]{'*'}:'';
foreach my $s (split(/(?=(?:^|\n)==)/, $intxt)){
if($s=~/^==\s*Redirected\s*==/){
foreach (split /\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/, $s){
next unless /^\Q| {{$linktmpl|\[\[:E([^]]+)\]\]Q}} \|\| {{$linktmpl|\[\[:E([^]]+)\]\]Q}} \|\|/;
$deleted{"$1>$2"}=$_;
}