summaryrefslogtreecommitdiffstats
path: root/extensions/RequestNagger
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-04-18 15:58:44 +0200
committerDylan William Hardison <dylan@hardison.net>2017-04-18 15:58:57 +0200
commitf04f94b31b39d3c93ab8723dc2061b04f9a28863 (patch)
treedc5e2f6847716cd005f35e5749a1f2eb63651af1 /extensions/RequestNagger
parentcfded4d89f7059a92239b0eb9daa452d9019e9fd (diff)
downloadbugzilla-f04f94b31b39d3c93ab8723dc2061b04f9a28863.tar.gz
bugzilla-f04f94b31b39d3c93ab8723dc2061b04f9a28863.tar.xz
Bug 1347175 - cron: Invalid local time for date in time zone: America/Los_Angeles
Diffstat (limited to 'extensions/RequestNagger')
-rwxr-xr-xextensions/RequestNagger/bin/send-request-nags.pl11
1 files changed, 6 insertions, 5 deletions
diff --git a/extensions/RequestNagger/bin/send-request-nags.pl b/extensions/RequestNagger/bin/send-request-nags.pl
index d9da4f04b..f823fc197 100755
--- a/extensions/RequestNagger/bin/send-request-nags.pl
+++ b/extensions/RequestNagger/bin/send-request-nags.pl
@@ -7,6 +7,7 @@
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
+use 5.10.1;
use strict;
use warnings;
@@ -42,10 +43,9 @@ if (my $filename = shift @ARGV) {
exit;
}
-my $dbh = Bugzilla->dbh;
-my $date = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
-my $now = datetime_from($date)->truncate( to => 'day' );
-$date = format_time($date, '%a, %d %b %Y %T %z', 'UTC');
+my $dbh = Bugzilla->dbh;
+my $db_date = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
+my $date = format_time($db_date, '%a, %d %b %Y %T %z', 'UTC');
# delete expired defers
$dbh->do("DELETE FROM nag_defer WHERE defer_until <= CURRENT_DATE()");
@@ -156,6 +156,7 @@ sub send_nags {
sub _include_request {
my ($request, $report) = @_;
+ state $now = datetime_from($db_date, 'UTC')->truncate( to => 'day' );
my $recipient = Bugzilla::User->new({ id => $request->{recipient_id}, cache => 1 });
@@ -180,7 +181,7 @@ sub _include_request {
}
# exclude weekends and re-check nag-interval
- my $date = datetime_from($request->{modification_date});
+ my $date = datetime_from($request->{modification_date}, 'UTC');
my $hours = 0;
$hours += 24 - $date->hour if $date->day_of_week <= 5;
$date->add( days => 1 )->truncate( to => 'day' );