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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: PERTableUpdater: * Create User:AnomieBOT/EDITREQTable for Category:Requested edits.
AnomieBOT (talk | contribs)
Updating published sources: PERTableUpdater: * Fix color on PER Titleblacklist protections.
Line 119:
 
my @data=(
[10,'PER','Wikipedia protected edit requests','protected','editprotected',[qw/red red red yellow clear yellow yellow/]],
[10,'SPER','Wikipedia semi-protected edit requests','semi-protected','editsemiprotected',[qw/red clear yellow red red red red/]],
[ 0,'EDITREQ','Requested edits','COI','requestedit',[qw/clear yellow yellow red red red red/]],
);
my $starttime=time;
Line 174:
 
# Protection scoring "bitmap":
# 80x80 = MediaWiki-namespace auto-protection
# 40x40 = Full protection
# 20x20 = User script auto-protection
# 10x10 = DirectlySemi-applied protection (as opposed to cascading,
# 0x08 = Directly-applied title blacklist, or auto)protection
# -10x04 = not protected atCascading all.protection
# 0x02 = Title blacklist protection
# Highest score by int value "wins".
my $protscore=-10;
$pd->{'prottype'}='Not protected';
$pd->{'reason'}='';
if($p->{'ns'}==8){
$pd->{'prottype'}='MediaWiki page';
$protscore=80x80;
} elsif($p->{'ns'}==2 && $t=~m!/.*\.js$!){
$pd->{'prottype'}='User JS page';
$protscore=20x20;
} elsif($p->{'ns'}==2 && $t=~m!/.*\.css$!){
$pd->{'prottype'}='User CSS page';
$protscore=20x20;
}
while(my ($re,$data)=each %tb){
next unless $t=~/^(?:$re)$/si;
my $sc=exists($data->{'opts'}{'autoconfirmed'})?00x12:40x42;
next if $sc<$protscore;
$pd->{'prottype'}=$data->{'source'};
Line 209 ⟶ 210:
next unless $pp->{'type'} eq 'edit';
my $sc=0;
$sc|=4 if ($pp->{'level'} eq 'sysop')?0x40:0x10;
$sc|=1 unless exists($pp->{'source'})?0x04:0x08;
next if $sc<$protscore;
if(exists($pp->{'source'})){
Line 226 ⟶ 227:
 
$pd->{'color'}=$colors->[0];
if($protscore>=0 & 0x10){
$pd->{'color'}=$colors->[1];
$pd->{'color'}=$colors->[32] if($protscore & 20x06);
$pd->{'color'}=$colors->[2] if($protscore & 4);
$pd->{'color'}=$colors->[3] if($protscore & 8);
}
$pd->{'color'}=$colors->[3] if($protscore & 80x20);
if($protscore & 0x40){
$pd->{'color'}=$colors->[4];
$pd->{'color'}=$colors->[25] if($protscore & 40x06);
}
$pd->{'color'}=$colors->[6] if($protscore & 0x80);
$pd->{'color'}='green' if($pd->{'color'} eq 'clear' && $p->{'ns'}==$greenns);