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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: PERTableUpdater: * Handle requests for create-protected pages.
AnomieBOT (talk | contribs)
Updating published sources: PERTableUpdater: * Handle multiple requests (on different talk pages) pointing to the same target page. * As a side effect, that fixes the problem where the request link is wrong if the request gets archived.
Line 79:
$api->store->{"SPER pages"}=$api->store->{"pages1"};
delete $api->store->{"pages1"};
}
if(($api->store->{"ver"}//1) < 2){
for my $tag (qw/PER TPER SPER EDITREQ/) {
next unless exists($api->store->{"$tag pages"});
my %old = my %{$pd=api->store->{"$tag pages{$t"}};
my %new = ();
while(my ($k,$v) = each %old) {
$new{$k}{$v->{'talk'}} = $v;
}
$api->store->{"$tag pages"} = \%new;
}
$api->store->{"ver"} = 2;
}
 
Line 191 ⟶ 203:
}
for my $t (@pages) {
my $pages{$t}tt =( $oldpagesp->{$t'title'} // {;
ns $pages{$t}{$tt}=> ($p->oldpages{'ns'$t}&~1,{$tt} // {
title => $t,
talk => $p->{'title'},
touched => ISO2timestamp($p->{'touched'}),
});
delete $pages{$t}{$tt}{'color'};
delete $pages{$t}{$tt}{'prottype'};
delete $pages{$t}{$tt}{'reason'};
delete $pages{$t}{$tt}{'logtitle'};
}
}
Line 217 ⟶ 229:
}
my $t=$p->{'title'};
 
my $pd=$pages{$t};
my ($k,$pd) = each %{$pages{$t}}; # Get first
 
# Protection scoring "bitmap":
Line 332 ⟶ 345:
}
$pd->{'logtitle'}=$pg;
 
# now fill in the rest
my @keys = qw/prottype reason color logtitle/;
while(my ($k, $pd2) = each %{$pages{$t}}) {
@{$pd2}{@keys} = @{$pd}{@keys};
}
}
}
 
# The formatting here is a little strange, for backwards compat
my @pages=map { values %$_ } values %pages;
my $txt=qq(<div class="veblenbot-pertable">\n);
$txt.=qq({| class="wikitable" style="padding:0em"\n);
$txt.=qq(|-\n);
my $ct=scalar keys %@pages;
my $s=($ct==1?'':'s');
my $pg='User:AnomieBOT/'.$tag.'Table';
Line 350 ⟶ 370:
$txt.=qq(! Protection level\n);
$txt.=qq(! class = "unsortable" | Last protection log entry\n);
for my $p (sort { $a->{'touched'} <=> $b->{'touched'} } values %@pages){
my $c=$colors{$p->{'color'}};
my $t=$p->{'title'};