Content deleted Content added
Updating published sources: PERTableUpdater: * On CAT:ESP, mark MediaWiki, user script, and most Title Blacklist entries as red instead of yellow. |
Updating published sources: PERTableUpdater: * Create User:AnomieBOT/EDITREQTable for Category:Requested edits. |
||
Line 13:
Created: 2011-12-01
Update [[User:AnomieBOT/PERTable]], [[User:AnomieBOT/SPERTable]], and [[User:AnomieBOT/
=end metadata
Line 68:
my $screwup=' Errors? [[User:'.$api->user.'/shutoff/PERTableUpdater]]';
# Upgrade
if(exists($api->store->{"pages0"})){
$api->store->{"PER pages"}=$api->store->{"pages0"};
delete $api->store->{"pages0"};
}
if(exists($api->store->{"pages1"})){
$api->store->{"SPER pages"}=$api->store->{"pages1"};
delete $api->store->{"pages1"};
}
# First, load MediaWiki:Titleblacklist to catch pages protected by
Line 108 ⟶ 118:
}
my @data=(
[10,'PER','Wikipedia protected edit requests','protected','editprotected',[qw/red red clear yellow/]],
[10,'SPER','Wikipedia semi-protected edit requests','semi-protected','editsemiprotected',[qw/red clear red red/]],
[ 0,'EDITREQ','Requested edits','COI','requestedit',[qw/clear yellow red red/]],
);
my $starttime=time;
for my $
my ($greenns,$tag,$cat,$type,$tgt,$colors)=@$data;
my $iter=$api->iterator(
generator => 'categorymembers',
gcmtitle =>
gcmlimit => 'max',
prop => 'info',
);
my %oldpages=%{$api->store->{
my %pages=();
while(my $p=$iter->next){
if(!$p->{'_ok_'}){
$api->warn("Failed to retrieve members for
return 60;
}
Line 141 ⟶ 157:
delete $pages{$t}{'logtitle'};
}
$api->store->{
if(%pages){
Line 151 ⟶ 167:
while(my $p=$iter->next){
if(!$p->{'_ok_'}){
$api->warn("Failed to retrieve members for
return 60;
}
Line 166 ⟶ 182:
# Highest score by int value "wins".
my $protscore=-1;
$pd->{'color'}='red';▼
$pd->{'prottype'}='Not protected';
$pd->{'reason'}='';
if($p->{'ns'}==8){
$pd->{'color'}='yellow' unless $sper;▼
$pd->{'prottype'}='MediaWiki page';
$protscore=8;
} elsif($p->{'ns'}==2 && $t=~m!/.*\.js$!){
$pd->{'color'}='yellow' unless $sper;▼
$pd->{'prottype'}='User JS page';
$protscore=2;
} elsif($p->{'ns'}==2 && $t=~m!/.*\.css$!){
$pd->{'color'}='yellow' unless $sper;▼
$pd->{'prottype'}='User CSS page';
$protscore=2;
Line 186 ⟶ 198:
my $sc=exists($data->{'opts'}{'autoconfirmed'})?0:4;
next if $sc<$protscore;
$pd->{'prottype'}=$data->{'source'};
my $line=$data->{'line'};
Line 201 ⟶ 212:
$sc|=1 unless exists($pp->{'source'});
next if $sc<$protscore;
$pd->{'color'}=($p->{'ns'}==10?'green':'clear') if($pp->{'level'} eq ($sper?'autoconfirmed':'sysop'));▼
if(exists($pp->{'source'})){
$pg=$pp->{'source'};
Line 214 ⟶ 224:
$pd->{'reason'}='';
}
if($protscore>=0){
$pd->{'color'}=$colors->[3] if($protscore & 8);
}
▲
if($pd->{'reason'} eq ''){
Line 255 ⟶ 274:
my $ct=scalar keys %pages;
my $s=($ct==1?'':'s');
my $
$txt.=qq(! $ct [[:Category:
▲ $txt.=qq(! $ct [[:Category:Wikipedia $type edit requests|$type edit request$s]] <div style="float:right;white-space:nowrap">[[$pg|v]]·<span class="plainlinks">[//en.wikipedia.org/w/index.php?title=$pg&action=history h]</span></div>\n);
$txt.=qq(|-\n);
$txt.=qq(|\n);
Line 265 ⟶ 283:
$txt.=qq(! Protection level\n);
$txt.=qq(! class = "unsortable" | Last protection log entry\n);
for my $p (sort { $a->{'touched'} <=> $b->{'touched'} } values %pages){
my $c=$colors{$p->{'color'}};
Line 298 ⟶ 315:
$intxt=~s#<!--TS-->.*<!--/TS-->#<!--TS-->~~~~~<!--/TS-->#g;
if($intxt ne $txt){
$api->log("
my $r=$api->edit($tok, $txt, "Update table ($ct request$s)", 0, 0);
if($r->{'code'} ne 'success'){
|