Content deleted Content added
Updating published sources: EnDashRedirectCreator: * Handle "reason" parameter to {{tlu|User:AnomieBOT/Auto-G8}}. * Add some commented-out code for reacting to the urn link the new check in {{tlu|User:AnomieBOT/Auto-G8}} adds. |
Updating published sources: EnDashRedirectCreator: * Add disabled code for finding redirects missing {{tl|R avoided double redirect}}. * Reorganize queries. * Supplemental BRFA for all this disabled code. |
||
Line 1:
{{ombox|type=notice|text= Approved 2016-03-08<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 74]]}}
{{ombox|type=notice|text= Supplemental BFRA approved 2020-06-19<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 80]]}}
{{ombox|type=notice|text= Supplemental BFRA approval requested 2025-08-23<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 86]]}}
<syntaxhighlight lang="perl">
package tasks::EnDashRedirectCreator;
Line 14 ⟶ 15:
+BRFA: Wikipedia:Bots/Requests for approval/AnomieBOT 80
+Status: Approved 2020-06-19
+BRFA: Wikipedia:Bots/Requests for approval/AnomieBOT 86
+Status: BRFA
Created: 2016-03-03
Line 75 ⟶ 78:
=for info
Supplemental BFRA approved 2020-06-19<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 80]]
=for info
Supplemental BFRA approval requested 2025-08-23<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 86]]
=cut
Line 87 ⟶ 93:
$api->task('EnDashRedirectCreator', 0, 10, qw/d::Redirects d::IWNS d::Talk d::Timestamp d::Templates/);
my $screwup=' Errors? [[User:'.$api->user.'/shutoff/EnDashRedirectCreator]]';
my $BRFA86 = 0;
my %ns = $api->namespace_map();
Line 175 ⟶ 183:
}
( $targetid ) = $dbh->selectrow_array( "SELECT lt_id FROM linktarget WHERE lt_namespace=2 AND lt_title = 'AnomieBOT/Auto-G8'" );
return 300;
}
my $autoG8Mismatch = '0=1';
my $needAvoidedRedir = '0=1';
my $needAutoG8 = '0=1';
if (
$autoG8Mismatch =
▲ my $targetid;
$needAutoG8 = "templatelinks.tl_from IS NULL";
▲ eval {
$needAvoidedRedir = "r1.rd_from IS
▲ if ( $@ ) {
my $botOwned = "revision.rev_page IS NOT NULL";
▲ $api->warn( "Error fetching linktarget ID from replica: $@\n" );
if ( $BRFA86 )
$botOwned = "( $botOwned OR templatelinks.tl_from IS NOT NULL )";
▲ }
$needAutoG8 = "NOT EXISTS( SELECT 1 FROM templatelinks WHERE tl_from=p2.page_id AND tl_target_id=$targetid )";▼
}
Line 203 ⟶ 220:
LEFT JOIN redirect AS r1 ON(r1.rd_from=p1.page_id)
LEFT JOIN redirect AS r2 ON(r2.rd_from=p2.page_id)
LEFT JOIN revision ON (rev_page = p2.page_id AND rev_actor IN ($actorIds) AND rev_parent_id = 0)
▲
WHERE
($dashcond) AND p1.page_namespace NOT IN ($skipNs)
AND (
p2.page_id IS NULL
▲ -- OR EXISTS( SELECT 1 FROM externallinks WHERE el_from = p2.page_id AND el_to_domain_index = 'urn:.' and el_to_path = 'x-anomiebot-auto-g8-mismatch:endash' )
OR (▼
r2.rd_namespace != COALESCE( r1.rd_namespace, p1.page_namespace )
OR r2.rd_title != COALESCE( r1.rd_title, p1.page_title )
OR r2.rd_fragment != r1.rd_fragment
OR $autoG8Mismatch
OR $needAutoG8
)
$cont
|