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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: DeletionSortingCleaner: * Yield like most other tasks do so it won't block other tasks so much.
AnomieBOT (talk | contribs)
Updating published sources: DeletionSortingCleaner: * Use Wikipedia:WikiProject Deletion sorting/Computer-readable.json rather than Wikipedia:WikiProject Deletion sorting/Compact.
Line 92:
# Load list of deletion sorting subpages to process
if ( ! defined( $self->{'pages'} ) ) {
$res=$api->query(titles=>'Wikipedia:WikiProject Deletion sorting/CompactComputer-readable.json',prop=>'linksrevisions',plnamespacervprop=>4"content",pllimitrvslots=>'max'"main",rvlimit=>1,formatversion=>2);
if($res->{'code'} ne 'success'){
$api->warn("Failed to get list of pages to process: ".$res->{'error'}."\n");
return 60;
}
my $json;
$self->{'pages'}=[ sort grep m!^Wikipedia:WikiProject Deletion sorting/!, map $_->{'title'}, @{(values %{$res->{'query'}{'pages'}})[0]{'links'}} ];
eval { $json = JSON->new->decode( $res->{'query'}{'pages'}[0]{'revisions'}[0]{'slots'}{'main'}{'content'} // '' ); };
if ( $@ ) {
$api->warn("Failed to parse Wikipedia:WikiProject Deletion sorting/Computer-readable.json: $@\n");
return 300;
}
my %pages = ();
for my $g (values %$json) {
for my $p (@$g) {
$pages{"Wikipedia:WikiProject Deletion sorting/$p"} = 1;
}
}
$self->{'pages'}=[ sort keys %pages ];
unless(@{$self->{'pages'}}){
$api->warn("No pages in list?");