Content deleted Content added
Updating published sources: DeletionSortingCleaner: * Trial approved, 7 days |
Updating published sources: d::Templates: * When getting the "sanitized" template name, strip bidi and whitespace as MediaWiki does. d::Talk: * Add to the standard note a note that if a reply is needed, go to the bot's talk page. DeletionSortingClean |
||
Line 132:
my $name2=$1;
REDO:
my $xfdtok=$api->edittoken($name);
Line 138 ⟶ 139:
$fail=300;
return undef;
if($xfdtok->{'code'} eq 'pageprotected'){
$cannoteditreason=$xfdtok->{'error'};
my $res=$api->query(
prop => 'revisions',
titles => $name,
rvprop => 'ids|timestamp|content|flags|user|size|comment',
);
$xfdtok=(values %{$res->{'query'}{'pages'}})[0];
$xfdtok->{'code'}=$res->{'code'};
$xfdtok->{'error'}=$res->{'error'};
}
if($xfdtok->{'code'} ne 'success'){
Line 147 ⟶ 159:
}
my %substlist=();
my $xfdintxt=$xfdtok->{'revisions'}[0]{'*'};
my $xfdouttxt=$api->process_templates($xfdintxt, sub {
Line 154 ⟶ 167:
return undef unless exists($xfdtemplates{"Template:$name"});
$substlist{$name}=1;
$wikitext=~s/^{{/{{subst:/; # }} }}
return $wikitext;
Line 160 ⟶ 174:
# We found templates to subst, so save the changed page and
# then reload it.
$t[$#
my $
my $
my $res=$api->whine("Editprotected request: please subst $t", "{{editprotected}} The template$s $t in [[$name|this page]] should be substed, but I cannot do so because \l$cannoteditreason. Please do so. Thanks.", Summary=>"[BOT] Editprotected request: please subst $t", Pagename=>$talk);
▲ return undef;
if($res->{'code'} ne 'success'){
# Don't worry about this error, just assume the
# discussion is not closed and retry next time around.
$api->warn("Editprotected request failed for $name: ".$res->{'error'}."\n");
$broken=1;
return undef;
}
} else {
$api->log("Substing templates in $name");
my $res=$api->edit($xfdtok, $xfdouttxt, "[[Wikipedia:Template substitution|substituting]] closure templates".$screwup, 1, 1);
if($res->{'code'} ne 'success'){
# Don't worry about this error, just assume the
# discussion is not closed and retry next time around.
$api->warn("Save failed for $name: ".$res->{'error'}."\n");
$broken=1;
return undef;
}
goto REDO;
}
▲ goto REDO;
}
|