Content deleted Content added
Updating published sources: DeletionSortingCleaner: * Handle MfD on deletion sorting pages |
Updating published sources: DeletionSortingCleaner: * Add the ability to have multiple archive pages, which I should have done a ''long'' time ago. |
||
Line 220:
# before saving the original page to minimize chances of being able to
# save one but not the other.
my ($apage,$atok,$atxt)=(undef,undef,undef);
if(@archive){
my ($
($apage = "$page/archive") =~ s/^Wikipedia://;
$res = $api->query(
generator => 'allpages',
gapnamespace => 4,
gapprefix => $apage,
gaplimit => 'max',
prop => 'info',
);
for my $p (values %{$res->{'query'}{'pages'}}) {
if ( $p->{'title'} eq "$page/archive" && $i <= 1) {
($i,$sz) = (1,$p->{'length'});
} elsif ( $p->{'title'} =~ /^\Q$page\/archive\E (\d+)$/ && $i <= $1 ) {
($i,$sz) = ($1,$p->{'length'});
}
}
$i++ if $sz > 1048576;
$apage = $i < 2 ? "$page/archive" : "$page/archive $i";
$atok=$api->edittoken($apage);
if($atok->{'code'} eq 'shutoff'){
$api->warn("Task disabled: ".$atok->{'content'}."\n");
Line 228 ⟶ 247:
}
if($atok->{'code'} ne 'success'){
$api->warn("Failed to get edit token for $
$broken=1;
next;
Line 242 ⟶ 261:
$atxt=~s/<!-- add old AfD discussions at the top -->/<!-- add old AfD discussions at the top -->\n$a/;
if($aintxt eq $atxt){
$api->whine("Broken deletion sorting archive page for $n", "The deletion sorting archive page [[$
$broken=1;
next;
Line 251 ⟶ 270:
if($outtxt ne $intxt){
$api->log("Archiving closed XfDs from $page...");
my $summary="[[$
$summary="[[$
$res=$api->edit($tok, $outtxt, $summary, 0, 1);
if($res->{'code'} ne 'success'){
Line 264 ⟶ 283:
}
if(defined($atok)){
$api->log("Archiving closed XfDs to $
$res=$api->edit($atok, $atxt, "Archiving closed XfDs from [[$page]]".$screwup, 0, 1);
if($res->{'code'} ne 'success'){
$api->warn("Save failed for $
$broken=1;
next;
|