Content deleted Content added
Updating published sources: TemplateUnsubster: * Don't add deprecated $N parameter. |
Updating published sources: General: * Update for the addition of 'rvslots'. DatedCategoryDeleterTest: * Disable. It's clear that task won't be needed. BrokenRedirectDeleter: * Handle pages with newlines before the <code>#REDIRECT</code>. |
||
(2 intermediate revisions by the same user not shown) | |||
Line 87:
prop => 'revisions',
rvprop => 'ids|timestamp|content',
rvslots => 'main',
rvlimit => 1,
);
Line 103 ⟶ 104:
return $t if $t > 0;
}
my $txt = $res->{'slots'}{'main'}{'*'};
$txt = $api->strip_nowiki($txt);
$txt =~ s/_/ /g;
Line 130 ⟶ 131:
next unless $p->{'ns'} == 10; # Sanity check
next unless exists( $p->{'pageid'} ) && exists( $p->{'lastrevid'} ); # Page missing or invalid?
if ( exists( $p->{'redirect'} ) ) { # Redirect?
$api->warn( "How did we manage to get a redirect ($p->{title}) in here? Skipping it." );
next;
}
next if $p->{'lastrevid'} eq ( $api->store->{'lastrev ' . $p->{'pageid'}} // 0 );
push @templates, $p->{'title'};
Line 140 ⟶ 145:
my $endtime = time() + 300;
my @retry = ();
my $re = $api->redirect_regex();
while ( @templates ) {
return 0 if $api->halting;
Line 148 ⟶ 154:
prop => 'revisions',
rvprop => 'ids|content',
rvslots => 'main',
rvlimit => 1,
);
Line 157 ⟶ 164:
my $pageid = $res->{'pageid'};
my $revid = $res->{'revisions'}[0]{'revid'};
my $intxt = $res->{'revisions'}[0]{'slots'}{'main'}{'*'};
(my $name = $title) =~ s/^Template://;
my $outtxt = undef;
# Sanity check
if ( $intxt =~ /$re/ ) {
$api->warn( "HELP: $title looks like a redirect, refusing to edit\n" );
goto skip;
}
# Split into template and noinclude parts, then process
Line 168 ⟶ 181:
} else {
$api->warn( "HELP: $title doesn't match the basic regular expression, refusing to edit\n" );
goto skip;
}
Line 197 ⟶ 211:
}
}
skip:
$api->store->{"lastrev $pageid"} = $revid;
$self->{'templates'} = [@templates, @retry];
Line 245 ⟶ 261:
my $params = shift;
$name =~ s!<includeonly>safesubst:</includeonly>!!;
$name =~ s!\{\{\{\|safesubst:\}\}\}!!;
return undef unless $name =~ /^\s*[iI]fsubst\s*$/;
foreach ($api->process_paramlist(@$params)) {
Line 273 ⟶ 289:
$name =~ s!^<includeonly>(?:safe)?subst:</includeonly>!!i;
$name =~ s!^\{\{\{\|(?:safe)?subst:\}\}\}!!i;
$name =~ s!^(?:safe)?subst:!!i;
return undef unless $name =~ /^\s*[uU]nsubst\s*$/;
|