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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: DatedCategoryCreator: * Allow certain cats to have backdated dates (currently just Category:Wikipedia articles in need of updating). TagDater: * Don't check years in missingcats logic, due to the above change.
AnomieBOT (talk | contribs)
Updating published sources: DatedCategoryCreator: * Tighten limits on creating future-dated non-empty categories.
Line 48:
my %oldcats=(
'Wikipedia articles in need of updating' => 1
);
 
# Categories to allow future dates, as well as the valid timespan in seconds
# (otherwise, the default is 86400)
my %futurecats=(
'Articles containing potentially dated statements' => 31622400
);
 
Line 59 ⟶ 65:
$monthnum{$months[$i]}=$i+1;
}
 
my $curyear;
 
sub new {
Line 94 ⟶ 98:
my @t=gmtime(time()+86400);
my $curmonth=strftime('%B %Y', @t);
$curyear=($t[5]+1900);
 
# Part 1: Create needed categories for the current month
Line 180 ⟶ 183:
return 0 if exists($skipcat{$parent});
}
returnmy 0$dt if= $y>futurecats{$curyearparent} // 86400;
my @t=gmtime(time()+$dt);
return 0 if $curyear=(y>$t[5]+1900);
return 0 if($y==$t[5]+1900 && $monthnum{$m}>$t[4]+1);
return 0 if(!exists($oldcats{$parent}) && $y<2004);
$txt.='}}';