Content deleted Content added
Updating published sources: AnomieBOT::API: * Add configuration variable (and accessor function) for the bot operator's username * Better logging when testing uploads All tasks: * Remove useless metadata field |
Updating published sources: AutoAssessor2: * Retire this task too, I think Lua now tends to handle this sort of thing. |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1:
{{ombox|type=notice|text= Approved 2008-12-07<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 15]]}}
{{ombox|type=notice|text= Retired 2025-02-01. Haven't had call to run this in a while, and I think Lua now handles this sort of thing anyway.}}
<
package tasks::AutoAssessor2;
Line 10 ⟶ 11:
Task: AutoAssessor2
BRFA: Wikipedia:Bots/Requests for approval/AnomieBOT 15
Status:
Created: 2008-11-26
OnDemand: true
Line 31 ⟶ 32:
# Request link, for edit summary.
my $req="[[User:AnomieBOT/req/WikiProject
# Increment this number every time a new run is started, so we don't have to
# mess around with deleting previous runs' database entries.
my $seq=
# If any of the 'verify' or 'params' functions need the page contents, set this
Line 49 ⟶ 50:
# canonicalize => If defined, any instance of the template will be renamed to
# this when edits are done to the page.
# addempty => If true, add empty "class=" and "importance=" to all banners.
# verify => If defined, must be a subroutine that will be called with the
# page and talkpage results. The subroutine must return a boolean value,
Line 57 ⟶ 59:
my %cfg_templates;
%cfg_templates=(
'
},▼
stubauto => 'auto',▼
blp => undef,▼
verify => undef,
params =>
if($mark&1){▼
push @$params, "bio=yes" unless(grep(s/^(\s*bio\s*=(?:\s*(?=\S))?).*?(\s*)$/${1}yes$2/s, @$params));▼
push @$params, "relativity=yes" unless(grep(s/^(\s*relativity\s*=(?:\s*(?=\S))?).*?(\s*)$/${1}yes$2/s, @$params));▼
},
);
Line 120 ⟶ 73:
my $self=$class->SUPER::new();
$self->{'did_templates'}=0;
$self->{'config loaded'}=0;
bless $self, $class;
return $self;
Line 128 ⟶ 82:
=for info
Approved 2008-12-07<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 15]]
=for info
Retired 2025-02-01. Haven't had call to run this in a while, and I think Lua now handles this sort of thing anyway.
=cut
Line 139 ⟶ 96:
my $res;
$api->task('AutoAssessor2', 0, 10, qw/d::WikiProjectTagging d::Redirects/);
# Load configs, if necessary
if(!$self->{'config loaded'}){
while(my ($banner,$cfg)=each %cfg_templates){
next unless exists($cfg->{'meta'});
$cfg=$api->WPBMetaConfig($cfg->{'meta'}, %$cfg) if exists($cfg->{'meta'});
$cfg->{'addempty'}=$ae;
$cfg_templates{$banner}=$cfg;
$self->{'config loaded'}=1;
}
if(!exists($api->store->{'metaseq'}) || $api->store->{'metaseq'}<$seq){
Line 150 ⟶ 119:
if(!$self->{'did_templates'}){
while(my ($t,$c)=each %cfg_templates){
my %redirs=$
▲ if($res->{'code'} ne 'success'){
return 60;
}
}
$self->{'did_templates'}=1;
Line 193 ⟶ 156:
$q2{'prop'}.='|revisions';
$q2{'rvprop'}='content';
}
Line 262 ⟶ 226:
# Get page text
my $intxt=$tok->{'revisions'}[0]{'slots'}{'main'}{'*'};
my ($outtxt,$nowiki)=$api->strip_nowiki($intxt);
my $any=0;
Line 290 ⟶ 254:
# Auto-assess
if($class && defined($classre) && !grep(/^\s*class\s*=\s*$classre\s*$/s, @params)){
push @params, "class=$class" unless(grep(s/^(\s*class\s*=(?:\s*(?=\S))?).*?(\s*)$/$1$class$2/s, @params));
if(defined($cfg{'stubauto'})){
Line 301 ⟶ 265:
}
}
if($imp && defined($impre) && !grep(/^\s*$impname\s*=\s*$impre\s*$/s, @params)){
push @params, "$impname=$imp" unless(grep(s/^(\s*$impname\s*=(?:\s*(?=\S))?).*?(\s*)$/$1$imp$2/s, @params));
# If requested to add empty parameters, do so
▲ push @
▲ push @
}
Line 312 ⟶ 282:
$any=1;
my @s=();
push @s, "class=$class" if($class && defined($classre));
push @s, "$impname=$imp" if($imp && defined($impre));
push @found, "{{$name}} (".join(' ', @s).')';
}
Line 369 ⟶ 339:
# No more pages to check, try again in 10 minutes or so in case of errors.
$api->log("AutoAssessor2 may be DONE!");
return 600;
}
Line 374 ⟶ 345:
1;
</syntaxhighlight>
|