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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: AnomieBOT::API: * Support HTTP/1.1 Keep-Alive, and use it by default All: * Replace "<code>defined($a)?$a:$b</code>" with "<code>$a // $b</code>" * Replace "<code>exists($a)?$a:$b</code>" with "<code>$a // $b</code>", unle
AnomieBOT (talk | contribs)
Updating published sources: WatchlistUpdater: * Allow for sorting the page list by other than titles. * New page to update: User:AnomieBOT/nobots tests
Line 104:
outerror => sub { "|-\n|colspan=\"2\"|".$_[1]."\n" },
outsuffix => sub { "|}" }
},
{
page => 'User:AnomieBOT/nobots tests',
beginmarker => "\n<!-- SNIP HERE -->\n",
endmarker => '',
frequency => 6*60*60,
maxrows => 10000,
query => {
list => 'allpages',
apprefix => 'AnomieBOT/nobots test ',
apnamespace => '2',
aplimit => 'max'
},
gcontinue => 'apcontinue',
result => 'allpages',
match => {},
summary => 'Automatically updating list of bot exclusion tests',
botflag => 1,
outprefix => sub { "" },
keyforpage => sub { my $t=$_[0]{'title'}; return $t unless $t=~/ (\d+)$/; return sprintf("%08d", $1)."|$t"; },
outformat => sub {
my $t=$_[1]{'title'};
$t=~s/^[^|]*\|//;
return "* [[$t]]\n";
},
outerror => sub { "* <strong class=\"error\">".$_[1]."</strong>\n" },
outsuffix => sub { "" }
}
);
Line 212 ⟶ 239:
next if ($_->{'ns'}&1)==1;
next unless _match($data->{'match'}, $_);
my $outk=exists($data->{'keyforpage'})?$_data->{'titlekeyforpage'}}=($_):$_->{'title'};
$out{$k}=$_;
last if ++$rows>$data->{'maxrows'};
}