Content deleted Content added
Updating published sources: General: * BREAKING CHANGE: And it's a big one: ** Data store changed from (binary) Storable to (readable) JSON. update-db.pl will change an existing database. This may affect the exact values storable in the permanent sto |
Updating published sources: SourceUploader: * Create empty shutoff pages if they don't exist, after a discussion where someone was confused by the non-existent page. |
||
Line 98:
);
my @dirs=($basedir);
$self->{'shutoff_pages'}=[];
while(my $dir=shift @dirs){
if(!opendir(D, $dir)){
Line 170 ⟶ 171:
} else {
$x.="|align=\"center\"| <span class=\"plainlinks\">[{{fullurl:User:$bot/shutoff/$task|action=edit}} Here]</span>\n";
push @{$self->{'shutoff_pages'}}, $task;
}
if(exists($metadata{'exclusion'}) && $metadata{'exclusion'} eq 'false'){
Line 254 ⟶ 256:
my @keys=keys(%{$self->{'pages'}});
if(!@keys && !@shutoff && !exists($self->{'tasklist'})){
$self->warn("Terminating task\n");
return undef;
}
$api->task('SourceUploader', 0, 10, qw/d::Util/);
my $src='User:'.$api->user.'/source';
Line 310 ⟶ 311:
next if $ret>0;
delete($self->{'tasklist'});
}
while(@shutoff){
my $task=shift @shutoff;
my $page='User:'.$api->user."/shutoff/$task";
my $tok=$api->edittoken($page);
if($tok->{'code'} eq 'shutoff'){
$api->warn("Task disabled: ".$tok->{'content'}."\n");
return 300;
}
return 60 if($tok->{'code'} ne 'success');
if(exists($tok->{'missing'})){
my $r=$api->edit($tok, '{{subst:void}}', 'Creating empty shutoff page to avoid redlinks in summaries and to avoid confusing people', 1, 1);
if($r->{'code'} ne 'success'){
$api->warn("Write error for $page: ".$r->{'error'}."\n");
return 60;
} else {
$api->warn("Created $page\n");
}
}
$self->{'shutoff_pages'}=[@shutoff];
}
Line 323 ⟶ 345:
my $tok=$api->edittoken($page);
if($tok->{'code'} eq 'shutoff'){
$
return 300;
}
Line 335 ⟶ 357:
my $r=$api->edit($tok, $text, $self->{'summary'}, 0, 1);
if($r->{'code'} ne 'success'){
$
return 60;
} else {
$
}
} else {
$
}
return 0;
|