User:AnomieBOT/source/tasks/TaskRedirectChecker.pm: Difference between revisions

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: TaskRedirectChecker: * Canonicalize redirect titles
AnomieBOT (talk | contribs)
Updating published sources: TaskRedirectChecker: * Canonicalize redirect titles
Line 55:
sub run {
my ($self, $api)=@_;
my $res;
 
$api->task('TaskRedirectChecker', 0, 10, qw(d::Timestamp d::Redirects d::Talk));
Line 79 ⟶ 80:
# Ask MediaWiki to canonicalize the title for us, because the actual
# normalization can depend on various factors.
my $res=$api->query(titles=>$title);
if($res->{'code'} ne 'success'){
$api->warn("Failed to get canonical name for $title: ".$res->{'error'}."\n");
Line 89 ⟶ 90:
# because the encoded anchors returned in "sections" varies based on
# server settings. Note this doesn't support {{anchor}} or the like.
my $res=$api->query(action=>'parse',title=>$title,text=>"__TOC__\n== XXX $anchor ==\n\n{{:$title}}",prop=>'sections');
if($res->{'code'} ne 'success'){
$api->warn("Failed to retrieve section list for $title: ".$res->{'error'});