Commit c011d1dc authored by terry%netscape.com's avatar terry%netscape.com

Reformated all the code to match the rest of Bugzilla.

parent e164c7a5
...@@ -31,55 +31,47 @@ require "globals.pl"; ...@@ -31,55 +31,47 @@ require "globals.pl";
ConnectToDatabase(); ConnectToDatabase();
GetVersionTable(); GetVersionTable();
foreach (@::legal_product) foreach (@::legal_product) {
{ my $dir = "data/mining";
my $dir = "data/mining";
&check_data_dir ($dir); &check_data_dir ($dir);
&collect_stats ($dir, $_); &collect_stats ($dir, $_);
} }
sub check_data_dir sub check_data_dir {
{ my $dir = shift;
my $dir = shift;
if (! -d) if (! -d) {
{ mkdir $dir, 0777;
mkdir $dir, 0777; chmod 0777, $dir;
chmod 0777, $dir; }
} }
}
sub collect_stats sub collect_stats {
{ my $dir = shift;
my $dir = shift; my $product = shift;
my $product = shift; my $when = localtime (time);
my $when = localtime (time);
my $query = <<FIN; my $query = "select count(bug_status) from bugs where (bug_status='NEW' or bug_status='ASSIGNED' or bug_status='REOPENED') and product='$product' group by bug_status";
select count(bug_status) from bugs where
(bug_status='NEW' or bug_status='ASSIGNED' or bug_status='REOPENED') $product =~ s/\//-/gs;
and product='$product' group by bug_status my $file = join '/', $dir, $product;
FIN my $exists = -f $file;
$product =~ s/\//-/gs;
my $file = join '/', $dir, $product; if (open DATA, ">>$file") {
my $exists = -f $file; SendSQL ($query);
if (open DATA, ">>$file") my %count;
{ push my @row, &today;
SendSQL ($query);
while (my @n = FetchSQLData())
my %count; {
push my @row, &today; push @row, @n;
}
while (my @n = FetchSQLData())
{ if (! $exists)
push @row, @n; {
} print DATA <<FIN;
if (! $exists)
{
print DATA <<FIN;
# Bugzilla daily bug stats # Bugzilla daily bug stats
# #
# do not edit me! this file is generated. # do not edit me! this file is generated.
...@@ -88,20 +80,17 @@ FIN ...@@ -88,20 +80,17 @@ FIN
# product: $product # product: $product
# created: $when # created: $when
FIN FIN
}
print DATA (join '|', @row) . "\n";
close DATA;
}
else
{
print "$0: $file, $!";
}
} }
sub today print DATA (join '|', @row) . "\n";
{ close DATA;
my ($dom, $mon, $year) = (localtime(time))[3, 4, 5]; } else {
return sprintf "%04d%02d%02d", 1900 + $year, ++$mon, $dom; print "$0: $file, $!";
} }
}
sub today {
my ($dom, $mon, $year) = (localtime(time))[3, 4, 5];
return sprintf "%04d%02d%02d", 1900 + $year, ++$mon, $dom;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment