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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: General: * Update for the addition of 'rvslots'. DatedCategoryDeleterTest: * Disable. It's clear that task won't be needed. BrokenRedirectDeleter: * Handle pages with newlines before the <code>#REDIRECT</code>.
AnomieBOT (talk | contribs)
Updating published sources: DeletionSortingCleaner: * Supplemental BRFA to remove duplicate entries in deletion sorting pages.
Line 1:
{{ombox|type=notice|text= Approved 2010-07-06<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 40]]}}
{{ombox|type=notice|text= Supplemental BFRA approval requested 2020-06-06<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 79]]}}
<syntaxhighlight lang="perl">
package tasks::DeletionSortingCleaner;
Line 11 ⟶ 12:
BRFA: Wikipedia:Bots/Requests for approval/AnomieBOT 40
Status: Approved 2010-07-06
+BRFA: Wikipedia:Bots/Requests for approval/AnomieBOT 79
+Status: BRFA
Created: 2010-06-18
 
Line 33 ⟶ 36:
use vars qw/@ISA/;
@ISA=qw/AnomieBOT::Task/;
 
my $brfa79=0;
 
sub new {
Line 47 ⟶ 52:
=for info
Approved 2010-07-06<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 40]]
 
=for info
Supplemental BFRA approval requested 2020-06-06<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 79]]
 
=cut
Line 122 ⟶ 130:
my @summary=();
my $fail=undef;
my $dups=0;
my %dups=();
my $outtxt=$api->process_templates($intxt, sub {
return undef if defined($fail);
Line 128 ⟶ 138:
return undef unless $name=~m!^(?i:Wikipedia|WP):(?:Articles|Miscellany) for deletion/(.+)$!;
my $name2=$1;
 
if($brfa79 && exists($dups{$name})){
$dups=1;
return '';
}
$dups{$name}=1;
 
my $cannoteditreason=undef;
Line 270 ⟶ 286:
# Now do the saving
if($outtxt ne $intxt){
$api->log("Archiving closed XfDs and/or removing duplicates from $page...");
my $summary="[[$apage|Archiving closed XfDs]]".$screwup.": ".join(" ", @summary);
if(@summary){
$summary="[[$apage|Archiving closed XfDs]]".$screwup.": [".scalar(@summary)." discussions]" if length($summary)>500;
$summary="[[$apage|Archiving closed XfDs]]" . ( $dups ? ' and removing duplicate XfDs' : '' ) . $screwup . ": " . join(" ", @summary);
$summary="[[$apage|Archiving closed XfDs]]" . ( $dups ? ' and removing duplicate XfDs' : '' ) . $screwup . ": [" . scalar(@$summary) . " discussions]" if length($summary)>500;
} else {
$summary = "Removing duplicate XfDs" . $screwup;
}
$res=$api->edit($tok, $outtxt, $summary, 0, 1);
if($res->{'code'} ne 'success'){