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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: PERTableUpdater: * Add User:AnomieBOT/PERTableHeader as a header to the pages.
AnomieBOT (talk | contribs)
Updating published sources: PERTableUpdater: * Correctly indicate protection of user json pages.
Line 167:
# 3: extended-confirmed protected
# 4: template protected
# 5: User CSS/JSJSON page
# 6: fullyUser protectedCSS/JS page
# 7: fully protected
# 8: "fully" protected via title blacklist
# 89: cascading protection
# 910: MediaWiki-namespace page
# 1011: MediaWiki-namespace CSS/JS page
my @data=(
[[10,828],'PER','Wikipedia fully-protected edit requests','protected','editprotected','x-wp-editprotected',[qw/red red red red red clear red clear yellow yellow yellow red/]],
[[10,828],'TPER','Wikipedia template-protected edit requests','template-protected','edittemplateprotected','x-wp-edittemplateprotected',[qw/red red red red clear red red red yellow red red red/]],
[[10,828],'EPER','Wikipedia extended-confirmed-protected edit requests','extended-confirmed-protected','editextendedprotected','x-wp-editextendedprotected',[qw/red red red clear red red red red red red red red/]],
[[10,828],'SPER','Wikipedia semi-protected edit requests','semi-protected','editsemiprotected','x-wp-editsemiprotected',[qw/red clear yellow red red red red red red red red red/]],
[[],'IPER','Wikipedia interface-protected edit requests','interface-protected','editinterfaceprotected','x-wp-editinterfaceprotected',[qw/red red red red red red clear red red red red clear/]],
[[0],'EDITREQ','Requested edits','COI','requestedit','x-wp-requestedit',[qw/clear yellow yellow red red red red red red red red/]],
);
my $starttime=time;
Line 253 ⟶ 254:
 
# Protection scoring "bitmap":
# 0x8000x8000 = MediaWiki-namespace CSS/JS auto-protection
# 0x4000x4000 = MediaWiki-namespace auto-protection
# 0x2000x2000 = Cascading protection
# 0x1000x1000 = Full protection
# 0x800x100 = User script auto-protection
# 0x40 0x80 = TemplateUser JSON auto-protection
# 0x20 0x40 = ExtendedTemplate-confirmed protection
# 0x10 0x20 = SemiExtended-confirmed protection
# 0x08 0x10 = DirectlySemi-applied protection
# 0x02 =0x08 Title= blacklistDirectly-applied protection
# 0x02 = Title blacklist protection
# Highest score by int value "wins".
my $protscore=0;
Line 269 ⟶ 271:
if($p->{'ns'}==8 && ($p->{'contentmodel'} eq 'javascript' || $t=~m!\.js$!)){
$pd->{'prottype'}='Site JS page';
$protscore=0xc000xc000;
} elsif($p->{'ns'}==8 && ($p->{'contentmodel'} eq 'css' || $t=~m!\.css$!)){
$pd->{'prottype'}='Site CSS page';
$protscore=0xc000xc000;
} elsif($p->{'ns'}==8){
$pd->{'prottype'}='MediaWiki page';
$protscore=0x4000x4000;
} elsif($p->{'ns'}==2 && ($p->{'contentmodel'} eq 'javascript' || $t=~m!/.*\.js$!)){
$pd->{'prottype'}='User JS page';
$protscore=0x800x100;
} elsif($p->{'ns'}==2 && ($p->{'contentmodel'} eq 'css' || $t=~m!/.*\.css$!)){
$pd->{'prottype'}='User CSS page';
$protscore=0x100;
} elsif($p->{'ns'}==2 && ($p->{'contentmodel'} eq 'json' || $t=~m!/.*\.json$!)){
$pd->{'prottype'}='User JSON page';
$protscore=0x80;
}
Line 306 ⟶ 311:
next unless $pp->{'type'} eq $prottype;
my $sc=0;
$sc|=0x1000x1000 if $pp->{'level'} eq 'sysop';
$sc|=0x40 if $pp->{'level'} eq 'templateeditor';
$sc|=0x20 if $pp->{'level'} eq 'extendedconfirmed';
$sc|=0x10 if $pp->{'level'} eq 'autoconfirmed';
$sc|=exists($pp->{'source'})?0x2000x2000:0x08;
$sc|=0x2000x2000 if exists($pp->{'cascade'});
next if $sc<$protscore;
if(exists($pp->{'source'})){
Line 337 ⟶ 342:
if($protscore & 0x40){
$pd->{'color'}=$colors->[4] if($protscore & 0x40);
$pd->{'color'}=$colors->[78] if($protscore & 0x02);
}
$pd->{'color'}=$colors->[5] if($protscore & 0x80);
$pd->{'color'}=$colors->[6] if($protscore & 0x100);
$pd->{'color'}=$colors->[87] if($protscore & 0x2000x1000);
$pd->{'color'}=$colors->[9] if($protscore & 0x4000x2000);
$pd->{'color'}=$colors->[10] if($protscore & 0x8000x4000);
$pd->{'color'}=$colors->[11] if($protscore & 0x8000);
$pd->{'color'}='green' if($pd->{'color'} eq 'clear' && grep($p->{'ns'}==$_, @$greenns));