Content deleted Content added
Updating published sources: POTDPageDeleter: * New task! |
Updating published sources: POTDPageDeleter: * Seems {{tl|db-xfd}} wasn't good enough for some people, they made a CSD criterion just for this task. |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1:
{{ombox|type=notice|text=
<syntaxhighlight lang="perl">
package tasks::POTDPageDeleter;
Line 10:
Task: POTDPageDeleter
BRFA: Wikipedia:Bots/Requests for approval/AnomieBOT III 5
Status:
Created: 2019-03-01
Delete Template:POTD protected/YYYY-MM-DD (per [[WP:CSD#
listed date, and remove the "See also" link from the corresponding
Template:POTD/YYYY-MM-DD.
Line 34:
my @reasons = (
'[[WP:CSD#
'[[WP:CSD#G8|G8]]: Subpage of a deleted page.',
'[[WP:CSD#G8|G8]]: Talk page of a deleted page.',
Line 49:
=for info
=cut
sub approved {
return
}
Line 63:
$screwup='If this bot is malfunctioning, please report it at [[User:'.$api->user.'/shutoff/POTDPageDeleter]]';
my $endtime = time() + 300;
my @when = gmtime;
Line 77 ⟶ 79:
while(my $p=$iter->next){
return 0 if $api->halting;
return 0 if time() >= $endtime; # Give other tasks a chance to run
if(!$p->{'_ok_'}){
$api->warn("Failed to retrieve POTD pages for deletion: ".$p->{'error'}."\n");
Line 111 ⟶ 115:
my $intxt = $tok->{'revisions'}[0]{'slots'}{'main'}{'*'};
my $outtxt = $intxt;
$outtxt =~ s!\n\*\s*\[\[Template:POTD(?:[ _]protected|\{\{#ifeq:\{\{BASEPAGENAME\}\}\|POTD protected\|\|
$outtxt =~ s!\n==\s*See also\s*==\s*(?=(?:\[\[Category:[^]]+\]\]\s*|<\!--(?>.*?-->)\s*)*(?:</noinclude>|$))!\n!;
$outtxt =~ s!<noinclude>\s*</noinclude>\s*$!!;
if ( $intxt ne $outtxt ) {
$api->log( "Removing reference to [[Template:POTD protected/$dt]] from $title2" );
$res = $api->edit( $tok, $outtxt, "Removing reference to deleted [[Template:POTD protected/$dt]]. $screwup", 0, 1 );
if($res->{'code'} ne 'success'){
Line 134 ⟶ 139:
while(my $p=$iter->next){
return 0 if $api->halting;
return 0 if time() >= $endtime; # Give other tasks a chance to run
if(!$p->{'_ok_'}){
$api->warn("Failed to retrieve POTD pages for deletion: ".$p->{'error'}."\n");
Line 171 ⟶ 178:
while(my $p=$iter->next){
return 0 if $api->halting;
return 0 if time() >= $endtime; # Give other tasks a chance to run
if(!$p->{'_ok_'}){
$api->warn("Failed to retrieve POTD talk pages for deletion: ".$p->{'error'}."\n");
|