Content deleted Content added
Updating published sources: PERTableUpdater: * Use classes rather than hard-coding colors, so the specific colors can be determined by community consensus and can be overridden by individual editors. |
Updating published sources: PERTableUpdater: * Use {{tl|v}} to generate view and history links. |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 14:
Update [[User:AnomieBOT/PERTable]], [[User:AnomieBOT/TPERTable]],
[[User:AnomieBOT/EPERTable]], [[User:AnomieBOT/SPERTable]],
[[User:AnomieBOT/
=end metadata
Line 76:
}
if(($api->store->{"ver"}//1) < 2){
for my $tag (qw/PER TPER SPER
next unless exists($api->store->{"$tag pages"});
my %old = %{$api->store->{"$tag pages"}};
Line 116:
return 60;
}
my $ln = 0;
for my $line (split /\r?\n/, $tb->{'content'}){
$ln++;
my $re=$line;
my %opts=();
Line 139 ⟶ 141:
my $tmp = $re;
$re=~s#(?<!\\[a-zA-Z])(?<!\\)\{(?!\d+(?:,\d*)?})#\\{#g;
$self->warnBadRegex( $api, "$page:$ln: Escaped left-braces in regex (old): $tmp" ) if $tmp ne $re;
$self->warnBadRegex( $api, "$page:$ln: Escaped left-braces in regex (new): $re" ) if $tmp ne $re;
# Validate each line, in case someone screws up the blacklist page
eval {
no warnings;
qr/^(?:$re)$/si;
};
if ( $@ ) {
$self->warnBadRegex( $api, "$page:$ln: Ignoring bad regex '$re'
next;
}
# Log non-fatal warnings too.
eval {
use warnings FATAL => 'all';
qr/^(?:$re)$/si;
};
if ( $@ ) {
$self->warnBadRegex( $api, "$page:$ln: Warning: $@\n");
}
Line 183 ⟶ 195:
# 11: MediaWiki-namespace CSS/JS page
my @data=(
[[10,828],'PER','Wikipedia fully
[[10,828],'TPER','Wikipedia template-protected edit requests','template-protected','edittemplateprotected','x-wp-edittemplateprotected',[qw/error error error error normal error error error caution error error error/]],
[[10,828],'EPER','Wikipedia extended-confirmed-protected edit requests','extended-confirmed-protected','editextendedprotected','x-wp-editextendedprotected',[qw/error error error normal error error error error error error error error/]],
[[10,828],'SPER','Wikipedia semi-protected edit requests','semi-protected','editsemiprotected','x-wp-editsemiprotected',[qw/error normal caution error error error error error error error error error/]],
[[],'IPER','Wikipedia interface-protected edit requests','interface-protected','editinterfaceprotected','x-wp-editinterfaceprotected',[qw/error error error error error error normal error error error error normal/]],
[[0],'
[[],'PREQ','Wikipedia partial-block edit requests','partial block','editpartiallyblocked','x-wp-editpartiallyblocked',[qw/normal caution caution caution error error error error error error error error/]],
);
my $starttime=time;
Line 237 ⟶ 250:
touched => ISO2timestamp($p->{'touched'}),
});
$pages{$t}{$tt}{'reqisredir'} = defined( $p->{'redirect'} );
delete $pages{$t}{$tt}{'color'};
delete $pages{$t}{$tt}{'prottype'};
Line 309 ⟶ 323:
$pd->{'prottype'}=$tb->{'source'};
my $line=$tb->{'line'};
$pd->{'reason'}=qq(Matching line: <syntaxhighlight lang="text"
$protscore=$sc;
}
Line 391 ⟶ 405:
}
$pd->{'logtitle'}=$pg;
$pd->{'isredir'}=defined( $p->{'redirect'} );
# now fill in the rest
Line 410 ⟶ 425:
my $s=($ct==1?'':'s');
my $pg='User:AnomieBOT/'.$tag.'Table';
$txt.=qq(! <section begin="count" />$ct<section end="count" /> [[:Category:$cat|$type edit request$s]]
$txt.=qq(|-\n);
$txt.=qq(|\n);
Line 425 ⟶ 440:
my $pt=$p->{'prottype'};
my $r=$p->{'reason'};
my $tl = $p->{'isredir'} ? "{{-r|1=$t}}" : "[[:$t]]";
my $ttl = $p->{'reqisredir'} ? "{{-r|1=$tt#$tgt|2=request}}" : "[[$tt#$tgt|request]]";
$txt.=qq(|- class="protectededit-legend-$c"\n);
$txt.=qq(|
$txt.=strftime("| %F %H:%M\n", gmtime $p->{'touched'});
$txt.=qq(| $pt <span class="plainlinks">([//en.wikipedia.org/w/index.php?title=Special:Log&type=protect&page=$et log])</span>\n);
Line 465 ⟶ 482:
my ($self, $api, $msg) = @_;
$msg =~ s/\s+$//;
my $warned = $api->store->{'warnedBadRegex'};▼
my $file = __FILE__;
return if exists( $warned->{$msg} );▼
$api->store->{'warnedBadRegex'} = $warned;▼
if ( ! defined( $api->
▲ my $warned = $api->store->{'warnedBadRegex'};
▲ return if exists( $warned->{$msg} );
$warned->{$msg} = 1;
▲ $api->store->{'warnedBadRegex'} = $warned;
}
$api->warn( "$msg\n" );
}
|