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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: WikiProjectWorker: * Done!
AnomieBOT (talk | contribs)
Updating published sources: WikiProjectWorker: * Start priority maintenance for WPBiography d::WikiProjectTagging: * Update WPBiography living and activepol regexes.
Line 33:
 
### Request link, for edit summary.
my $req="[[User:AnomieBOT/req/WikiProject TrainsBiography 1|request]]";
 
### 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=910;
 
### How to find the pages?
my @cats=(
'Category:Biography articles with more than one work group needing priority parameter replacement',
);
my @iterators=(
{
generator => 'linkscategorymembers',
titles gcmtitle => 'User:NE2/TWP'[@cats],
gpllimitgcmlimit => '100',
prop => 'templates',
tllimit => 'max',
},
);
Line 70 ⟶ 69:
 
# Banner configurations.
my $main_banner='TrainsWikiProjectWPBiography';
my @preprocess_templates=();
my %banner_cfgs=(
'TrainsWikiProjectWPBiography' => {
meta => 0,
importance => '',
blp => qr/(?:living|blpo)\s*=\s*+(?!(?i)no|n|0|$|¬)/,
activepol => qr/activepol\s*=\s*+(?!(?i)no|n|0|$|¬)/,
},
);
 
my %wg=(
'a&e-work-group' => 'a&e-priority',
'filmbio-work-group' => 'filmbio-priority',
'musician-work-group' => 'musician-priority',
'military-work-group' => 'military-priority',
'peerage-work-group' => 'peerage-priority',
'politician-work-group' => 'politician-priority',
'royalty-work-group' => 'royalty-priority',
's&a-work-group' => 's&a-priority',
'sport-work-group' => 'sport-priority',
);
 
Line 96 ⟶ 110:
 
sub approved {
return -1;
}
 
Line 192 ⟶ 206:
}
}
push @params, 'auto=yes' if ($assess // '') eq 'stub';
} else {
push @params, "class=$class";
Line 247 ⟶ 260:
$page=$api->query(
titles => $pg,
prop => 'templates',
tllimit => 'max',
);
if($page->{'code'} eq 'shutoff'){
Line 260 ⟶ 271:
$page=(values %{$page->{'query'}{'pages'}})[0];
}
 
if(grep($_->{'title'} eq 'Template:Infobox Closed London station', @{$page->{'templates'}}) ||
grep($_->{'title'} eq 'Template:Infobox GB station', @{$page->{'templates'}}) ||
grep($_->{'title'} eq 'Template:Infobox London station', @{$page->{'templates'}}) ||
grep($_->{'title'} eq 'Template:Infobox UK disused station', @{$page->{'templates'}}) ||
grep($_->{'title'} eq 'Template:Infobox UK heritage station', @{$page->{'templates'}}) ||
grep($_->{'title'} eq 'Template:WikiProject London Transport', @{$tok->{'templates'}})){
push @params, 'UK=yes';
push @params, 'UK-importance=';
}
push @params, 'stations=yes' if($pg=~/station|depot/i);
 
$outtxt=$api->WPBadd($outtxt, $assess, sub {
Line 280:
my $new=shift;
return undef if $new;
 
my $prio=undef;
foreach my $p (@$params){
$prio=$1 if $p=~/^\s*priority\s*=\s*(\S.*?)\s*$/;
}
return $wikitext unless defined($prio);
pushmy @params, 'UK-importancepp='();
foreach my $p (@$params){
next if $p=~/^\s*priority\s*=/;
if($p=~/^(\s*([^=]*?)\s*=\s*+(?!(?i)no|n|0|$|¬).*?)(\s*)$/ && exists($wg{$2})){
prop push @pp, => 'templates',$1;
push @pp, $wg{$2}.'='.$prio.$3;
prop => 'templates',} else {
tllimit push @pp, => 'max',$p;
tllimit => 'max', }
}
push @$params, 'UK=yes'\@pp;
 
my $any=0;
Line 292 ⟶ 309:
}
}
#return $wikitext unless $any;
 
my $out="{{$oname";
Line 298 ⟶ 315:
$out.="}}";
return $wikitext if $out eq $wikitext;
push @summary, "updating {{$main_banner}} workgroup priority" unless @summary;
return $out;
}, $main_banner, @params);