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: d::WikiProjectTagging: * Change the stubauto parameter to be able to represent "auto=yes" or "auto=stub". WikiProjectWorker: * Tag WPBannerMeta banners with "auto=inherit" if assessment is inherited. * Start run for Wik...
Line 33:
 
### Request link, for edit summary.
my $req="[[User:AnomieBOT/req/WikiProject Adventure gamesBiophysics 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=1718;
 
### How to find the pages?
my @cats=(
'Category:Animal flight',
'Category:Bioelectrochemistry',
'Category:Biological matter',
'Category:Biomechanics',
'Category:Biophysicists',
'Category:Bird flight',
'Category:Cell adhesion molecules',
'Category:Cell movement',
'Category:Ion channels',
'Category:Locomotion',
'Category:Magnetoception',
'Category:Membrane biology',
'Category:Protein targeting',
'Category:SIGLEC',
'Category:Structural biology',
'Category:Welsh biophysicists',
);
my @iterators=(
{
generator => 'embeddedincategorymembers',
geititlegcmtitle => ['Template:WikiProject Adventure games'@cats],
geilimitgcmlimit => 100,
},
);
Line 53 ⟶ 69:
### page to tag (or undef to skip).
sub filter {
# $_[0]->{'title'}='Talk:'.$_[0]->{'title'} if $_[0]->{'ns'}==0;
# $_[0]->{'title'}=~s/^([^:]*):/$1 talk:/ if($_[0]->{'ns'}!=0 && ($_[0]->{'ns'}&1)==0);
return $_[0]->{'title'};
}
Line 60 ⟶ 76:
### How to copy other projects' assessments
sub copy_class {
#return ($_[0]->WPBmax($_[2], 'WikiProject Thailand'))[0];
#return '';
}
 
sub copy_importance {
#return ($_[0]->WPBmax($_[2], 'WikiProject Thailand'))[1];
#return '';
}
 
# Banner configurations.
my $main_banner='WikiProject Video gamesBiophysics';
my @preprocess_templates=('WikiProject Adventure games');
my %banner_cfgs=(
'WikiProject Video gamesBiophysics' => {
meta => 1,
canonicalize => 'WikiProject Video gamesBiophysics',
stubauto => undef,
},
);
Line 102 ⟶ 117:
 
sub approved {
return -1;
}
 
Line 118 ⟶ 133:
$cfg=$api->WPBMetaConfig($cfg->{'meta'}, %$cfg) if exists($cfg->{'meta'});
$cfg{$banner}=$cfg;
$banner_cfgs{$banner}{'stubauto'}=$cfg->{'stubauto'};
}
$api->WPBconfig(%cfg);
Line 187 ⟶ 203:
next;
}
if($class eq ''){=~s/^\s+|\s+$//g;
$assess=$api->WPBassess($title);
if(ref($assess) eq 'HASH'){
if($assess->{'code'} eq 'pagemissing'){
# No subject page, doesn't matter
$assess=undef;
} else {
$api->warn("Processing $title failed: ".$assess->{'error'}."\n");
next;
}
}
}
if($class eq '' || lc($class) eq lc($assess)){
$class='';
} else {
$assess=undef;
push @params, "class=$class";
my $imp = copy_importance($api, $title, $intxt);
Line 235 ⟶ 254:
return undef if(grep $name eq $_, @main_banners);
 
push @params, 'Adventure=yes' if $banner eq 'WikiProject Adventure games';
push @merge, $oname;
 
Line 279 ⟶ 297:
my $wikitext=shift;
my $new=shift;
#return '' if $new;
 
return undef unless(grep $banner eq $_, @main_banners);
Line 293 ⟶ 311:
unshift @$params, "$k=$v" unless(grep(s/^(\s*\Q$k\E\s*=\s*?)(?:\S.*?)?(\s*)$/$1$v$2/s, @$params));
$any=1 unless $v eq '';
if($k eq 'class' && ($cfg{'meta'}//0) && ($cfg{'stubauto'}//'')){
my $aa=$cfg{'stubauto'};
$aa=~s/\s*=.*//;
push @$params, "$aa=inherit" unless(grep(s/^(\s*\Q$aa\E\s*=\s*?)(?:\S.*?)?(\s*)$/$1inherit$2/s, @$params));
}
}
}
if($new && $class && (grep /^class=/, @$params) && ($cfg{'meta'}//0) && ($cfg{'stubauto'}//'')){
my $aa=$cfg{'stubauto'};
$aa=~s/\s*=.*//;
push @$params, "$aa=inherit" unless(grep(s/^(\s*\Q$aa\E\s*=\s*?)(?:\S.*?)?(\s*)$/$1inherit$2/s, @$params));
$any=1;
}
return $wikitext unless $any;