Content deleted Content added
Updating published sources: PERTableUpdater: * Use a unicode-safe URI encoding function. |
Updating published sources: PERTableUpdater: * I didn't know there was a global title blacklist. |
||
Line 65:
my $res;
$api->task('PERTableUpdater', 0, 10, qw/d::Sections d::Timestamp d::Talk d::IWNS/);
my $screwup=' Errors? [[User:'.$api->user.'/shutoff/PERTableUpdater]]';
Line 72:
# that mechanism
my %tb=();
'Global title blacklist' => 'meta:Title blacklist',
$api->warn("Failed to load MediaWiki:Titleblacklist: ".$tb->{'error'}."\n");▼
while(my ($k,$page)=each %sources){
}▼
▲ my %opts=();
for my $line (split
my $
for my $opt (split /\s*\|\s*/, $opts){
if($opt=~/^([^=]*?)\s*=\s*(.+)$/){
$opts{lc($1)}=$2;
} else {
$opts{lc($opt)}=1;
}
}
}
$re=
$re=~s!({{\s*ns\s*:\s*(.+?)\s*}})! replace_ns($api,$2) // $1 !ge;
# Let's just hope no one ever uses {{ns:}} or {{int:}} here...▼
$tb{$re}={ line=>$line, opts=>\%opts } if($opts{'noedit'}//0);▼
▲ $tb{$re}={ source=>"[[$page|$k]]", line=>$line, opts=>\%opts } if($opts{'noedit'}//0);
}▼
}
Line 134 ⟶ 142:
}
$api->store->{'pages'.$sper}=\%pages;
if(%pages){
$iter=$api->iterator(
Line 164 ⟶ 172:
next unless $t=~/^(?:$re)$/si;
$pd->{'color'}='yellow' unless(exists($data->{'opts'}{'autoconfirmed'}) && !$sper);
$pd->{'prottype'}=$data->{'
my $line=$data->{'line'};
$pd->{'reason'}=qq(Matching line: <syntaxhighlight lang="text" enclose="none">$line</syntax).qq(highlight>);
Line 299 ⟶ 307:
$t=uri_escape_utf8($t, '^A-Za-z0-9_\-.:/~');
return $t;
}
sub replace_ns {
my ($api,$ns)=@_;
if($ns=~/^([+-]?[0-9]+)/){
$ns=int($1);
} else {
$ns=~s/_/ /g;
my %x=$api->namespace_map();
$ns=$x{$ns} // undef;
return undef unless defined($ns);
▲ }
my %x=$api->namespace_reverse_map();
return $x{$ns} // undef;
}
|