my ($self) = @_;
return [] if !(@{$self->initial_bug_ids});
my $bug_ids = join ', ', @{$self->initial_bug_ids};
- my $start_date = $self->start_date->ymd('-');
+ my $start_date = $self->start_date->strftime('%Y-%m-%d %H:%M:%S');
my $query = qq{
SELECT
bug_id,
WHERE
bug_id IN ($bug_ids)
AND field.name IN ('keywords' , 'bug_status')
- AND bug_when >= '$start_date 00:00:00'
+ AND bug_when >= '$start_date'
GROUP BY bug_id , bug_when , field.name
};
# Don't use selectall_hashref as it only gets the latest event each bug.
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
#
-# Usage secbugsreport.pl YYYY MM DD, e.g. secbugsreport.pl $(date +'%Y %m %d')
+# Usage secbugsreport.pl YYYY MM DD HH MM SS +|-ZZZZ
+# e.g. secbugsreport.pl $(date +'%Y %m %d %H %M %S %z')
use 5.10.1;
use strict;
BEGIN { Bugzilla->extensions }
Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
-my ($year, $month, $day) = @ARGV;
+my ($year, $month, $day, $hours, $minutes, $seconds, $time_zone_offset) = @ARGV;
exit 0 unless Bugzilla->params->{report_secbugs_active};
-exit 0 unless Int->check($year) && Int->check($month) && Int->check($day);
+exit 0
+ unless Int->check($year)
+ && Int->check($month)
+ && Int->check($day)
+ && Int->check($hours)
+ && Int->check($minutes)
+ && Int->check($seconds);
my $html;
-my $template = Bugzilla->template();
-my $end_date = DateTime->new(year => $year, month => $month, day => $day);
+my $template = Bugzilla->template();
+my $end_date = DateTime->new(
+ year => $year,
+ month => $month,
+ day => $day,
+ hour => $hours,
+ minute => $minutes,
+ second => $seconds,
+ time_zone => $time_zone_offset
+);
+$end_date->set_time_zone('UTC');
+
my $start_date = $end_date->clone()->subtract(months => 12);
my $report_week = $end_date->ymd('-');
my $teams = decode_json(Bugzilla->params->{report_secbugs_teams});
encoding => 'base64',
},
body => $report->graphs->{$_}->slurp,
- )
+ )
} sort { $a cmp $b } keys %{$report->graphs}
);