Content deleted Content added
Updating published sources: TemplateSubster: * Split logic into a "base" class, to share with the new TFDTemplateSubster. TFDTemplateSubster: * New task! |
Updating published sources: TFDTemplateSubster: * Don't do <code>JSON->utf8</code>. AnomieBOT::API returns and expects Unicode strings, not utf8-encoded strings. |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1:
{{ombox|type=notice|text=
<syntaxhighlight lang="perl">
package tasks::TFDTemplateSubster;
Line 10:
Task: TFDTemplateSubster
BRFA: Wikipedia:Bots/Requests for approval/AnomieBOT 78
Status:
Created: 2020-01-31
Line 44:
=for info
=cut
sub approved {
return
}
Line 141:
$api->warn( "Failed to get redirects: " . $r{''}{'error'} . "\n" );
return 60;
}
# Handle normalizations, e.g. underscore to space.
while ( my ( $r, $t ) = each( %r ) ) {
if ( defined( $workList{$r} ) && !defined( $workList{$t} ) ) {
$workList{$t} = $workList{$r};
delete $workList{$r};
}
}
Line 162 ⟶ 170:
if ( $status->[0] < $revid ) {
eval {
$status->[1] = JSON->new
};
$status->[1] = {} unless ref( $status->[1] ) eq 'HASH';
Line 186 ⟶ 194:
if ( $writeStatus ) {
$api->log( "Updating processing status page" );
my $outtxt = JSON->new
my $res2 = $api->edit( $tok, $outtxt, 'Updating status page', 1, 1, contentmodel => 'json' );
if ( $res2->{'code'} eq 'success' ) {
|