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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: PERTableUpdater: * Prefer reporting direct full protection to cascading protection.
AnomieBOT (talk | contribs)
Updating published sources: PERTableUpdater: * Don't override full protection from the title blacklist with direct semi-protection. Or, for that matter, MediaWiki-namespace protection with anything, or user-script protection with semi-protection.
Line 156:
my $t=$p->{'title'};
my $pd=$pages{$t};
 
# Protection scoring "bitmap":
# 8 = MediaWiki-namespace auto-protection
# 4 = Full protection
# 2 = User script auto-protection
# 1 = Directly-applied protection (as opposed to cascading,
# title blacklist, or auto)
# -1 = not protected at all.
# Highest score by int value "wins".
my $protscore=-1;
$pd->{'color'}='red';
$pd->{'prottype'}='Not protected';
Line 162 ⟶ 172:
$pd->{'color'}='yellow';
$pd->{'prottype'}='MediaWiki page';
$protscore=8;
} elsif($p->{'ns'}==2 && $t=~m!/.*\.js$!){
$pd->{'color'}='yellow';
$pd->{'prottype'}='User JS page';
$protscore=2;
} elsif($p->{'ns'}==2 && $t=~m!/.*\.css$!){
$pd->{'color'}='yellow';
$pd->{'prottype'}='User CSS page';
$protscore=2;
}
while(my ($re,$data)=each %tb){
next unless $t=~/^(?:$re)$/si;
my $sc=exists($data->{'opts'}{'autoconfirmed'})?0:4;
next if $sc<$protscore;
$pd->{'color'}='yellow' unless(exists($data->{'opts'}{'autoconfirmed'}) && !$sper);
$pd->{'prottype'}=$data->{'source'};
my $line=$data->{'line'};
$pd->{'reason'}=qq(Matching line: <syntaxhighlight lang="text" enclose="none">$line</syntax).qq(highlight>);
$protscore=$sc;
}
 
my $protscore=-1;
my $expiry=undef;
my $pg=$t;
Line 183 ⟶ 198:
next unless $pp->{'type'} eq 'edit';
my $sc=0;
$sc|=24 if $pp->{'level'} eq 'sysop';
$sc|=1 unless exists($pp->{'source'});
next if $sc<$protscore;