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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: SourceUploader: * Add some debugging and better error handling.
AnomieBOT (talk | contribs)
Updating published sources: AnomieBOT::API: * Fix bug where <code>$api->copy()</code> screwed up <code>$api->store</code>. PERTableUpdater: * Update for the new "extended confirmed" protection level.
Line 14:
 
Update [[User:AnomieBOT/PERTable]], [[User:AnomieBOT/TPERTable]],
[[User:AnomieBOT/EPERTable]], [[User:AnomieBOT/SPERTable]], and
[[User:AnomieBOT/EDITREQTable]].
 
=end metadata
Line 164 ⟶ 165:
# 1: semi-protected
# 2: semi-protected via title blacklist
# 3: templateextended protected
# 4: Usertemplate CSS/JS pageprotected
# 5: fullyUser protectedCSS/JS page
# 6: fully protected
# 7: "fully" protected via title blacklist
# 78: cascading protection
# 89: MediaWiki-namespace page
my @data=(
[[10,828],'PER','Wikipedia fully-protected edit requests','protected','editprotected','x-wp-editprotected',[qw/red red red red red yellow clear yellow yellow yellow/]],
[[10,828],'TPER','Wikipedia template-protected edit requests','template-protected','edittemplateprotected','x-wp-edittemplateprotected',[qw/red red red clear red red red yellow red red/]],
[[10,828],'SPEREPER','Wikipedia semiextended-confirmed-protected edit requests','semi-protectededitextendedprotected','editsemiprotectededitextendedprotected','x-wp-editsemiprotectededitextendedprotected',[qw/red clearred yellowred red clear red red red red red/]],
[[010,828],'EDITREQSPER','RequestedWikipedia editssemi-protected edit requests','COIsemi-protected','requestediteditsemiprotected','x-wp-requestediteditsemiprotected',[qw/red clear yellow yellowred red red red red red red/]],
[[0],'EDITREQ','Requested edits','COI','requestedit','x-wp-requestedit',[qw/clear yellow yellow red red red red red red/]],
);
my $starttime=time;
Line 248 ⟶ 251:
 
# Protection scoring "bitmap":
# 0x2000x400 = MediaWiki-namespace auto-protection
# 0x1000x200 = Cascading protection
# 0x800x100 = Full protection
# 0x400x80 = User script auto-protection
# 0x200x40 = Template-protection
# 0x20 = Extended-protection
# 0x10 = Semi-protection
# 0x08 = Directly-applied protection
Line 262 ⟶ 266:
if($p->{'ns'}==8){
$pd->{'prottype'}='MediaWiki page';
$protscore=0x2000x400;
} elsif($p->{'ns'}==2 && $t=~m!/.*\.js$!){
$pd->{'prottype'}='User JS page';
$protscore=0x400x80;
} elsif($p->{'ns'}==2 && $t=~m!/.*\.css$!){
$pd->{'prottype'}='User CSS page';
$protscore=0x400x80;
}
 
Line 279 ⟶ 283:
}
if ( $tb && $tb->{'source'} ) {
my $sc=exists($tb->{'opts'}{'autoconfirmed'})?0x12:0x220x42;
next if $sc<$protscore;
$pd->{'prottype'}=$tb->{'source'};
Line 293 ⟶ 297:
next unless $pp->{'type'} eq $prottype;
my $sc=0;
$sc|=0x800x100 if $pp->{'level'} eq 'sysop';
$sc|=0x200x40 if $pp->{'level'} eq 'templateeditor';
$sc|=0x10 if $pp->{'level'} eq 'autoconfirmed';
$sc|=exists($pp->{'source'})?0x1000x200:0x08;
$sc|=0x1000x200 if exists($pp->{'cascade'});
next if $sc<$protscore;
if(exists($pp->{'source'})){
Line 319 ⟶ 323:
$pd->{'color'}=$colors->[2] if($protscore & 0x02);
}
$pd->{'color'}=$colors->[3] if($protscore & 0x20){;
$pd->{'color'}=$colors->[3] if($protscore & 0x200x40);{
$pd->{'color'}=$colors->[64] if($protscore & 0x020x40);
$pd->{'color'}=$colors->[47] if($protscore & 0x400x02);
}
$pd->{'color'}=$colors->[4] if($protscore & 0x40);
$pd->{'color'}=$colors->[5] if($protscore & 0x80);
$pd->{'color'}=$colors->[76] if($protscore & 0x100);
$pd->{'color'}=$colors->[8] if($protscore & 0x200);
$pd->{'color'}=$colors->[9] if($protscore & 0x400);
$pd->{'color'}='green' if($pd->{'color'} eq 'clear' && grep($p->{'ns'}==$_, @$greenns));