]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1538957 - Add debugging information to emails for investigating in more detail...
authorDylan William Hardison <dylan@hardison.net>
Thu, 28 Mar 2019 22:19:41 +0000 (18:19 -0400)
committerGitHub <noreply@github.com>
Thu, 28 Mar 2019 22:19:41 +0000 (18:19 -0400)
scripts/secbugsreport.pl

index a23a6efe50c4e95e7ffd99558f2bb1325dac0e26..67141e97e7a766e30f18e49d20df09fa9730d2a8 100644 (file)
@@ -25,18 +25,21 @@ use Bugzilla::Report::SecurityRisk;
 use DateTime;
 use URI;
 use JSON::MaybeXS;
-use Mojo::File;
+use Mojo::File qw(path);
+use Data::Dumper;
+use Types::Standard qw(Int);
 
 BEGIN { Bugzilla->extensions }
 Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
 
+my ($year, $month, $day) = @ARGV;
+
 exit 0 unless Bugzilla->params->{report_secbugs_active};
-exit 0 unless defined $ARGV[0] && defined $ARGV[1] && defined $ARGV[2];
+exit 0 unless Int->check($year) && Int->check($month) && Int->check($day);
 
 my $html;
-my $template = Bugzilla->template();
-my $end_date
-  = DateTime->new(year => $ARGV[0], month => $ARGV[1], day => $ARGV[2]);
+my $template     = Bugzilla->template();
+my $end_date     = DateTime->new(year => $year, month => $month, day => $day);
 my $start_date   = $end_date->clone()->subtract(months => 12);
 my $report_week  = $end_date->ymd('-');
 my $teams        = decode_json(Bugzilla->params->{report_secbugs_teams});
@@ -107,6 +110,9 @@ my $email = Email::MIME->create(
 
 MessageToMTA($email);
 
+my $report_dump_file = path(bz_locations->{datadir}, "$year-$month-$day.dump");
+$report_dump_file->spurt(Dumper($report));
+
 sub build_bugs_link {
   my ($arr, $product) = @_;
   my $uri = URI->new(Bugzilla->localconfig->{urlbase} . 'buglist.cgi');