summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterry%netscape.com <>1999-03-06 04:48:26 +0100
committerterry%netscape.com <>1999-03-06 04:48:26 +0100
commitc011d1dc335571a1b07c64a7f3af1d97c67e2c11 (patch)
tree65c496fce7e008909ac06002450b1abe68e9db09
parente164c7a5857c48f97daa7d1ab21fb41463640a67 (diff)
downloadbugzilla-c011d1dc335571a1b07c64a7f3af1d97c67e2c11.tar.gz
bugzilla-c011d1dc335571a1b07c64a7f3af1d97c67e2c11.tar.xz
Reformated all the code to match the rest of Bugzilla.
-rwxr-xr-xcollectstats.pl105
1 files changed, 47 insertions, 58 deletions
diff --git a/collectstats.pl b/collectstats.pl
index 05e6204cb..6c51d1afc 100755
--- a/collectstats.pl
+++ b/collectstats.pl
@@ -31,55 +31,47 @@ require "globals.pl";
ConnectToDatabase();
GetVersionTable();
-foreach (@::legal_product)
- {
- my $dir = "data/mining";
+foreach (@::legal_product) {
+ my $dir = "data/mining";
- &check_data_dir ($dir);
- &collect_stats ($dir, $_);
- }
+ &check_data_dir ($dir);
+ &collect_stats ($dir, $_);
+}
-sub check_data_dir
- {
- my $dir = shift;
+sub check_data_dir {
+ my $dir = shift;
- if (! -d)
- {
- mkdir $dir, 0777;
- chmod 0777, $dir;
- }
- }
+ if (! -d) {
+ mkdir $dir, 0777;
+ chmod 0777, $dir;
+ }
+}
-sub collect_stats
- {
- my $dir = shift;
- my $product = shift;
- my $when = localtime (time);
+sub collect_stats {
+ my $dir = shift;
+ my $product = shift;
+ my $when = localtime (time);
- my $query = <<FIN;
-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
-FIN
- $product =~ s/\//-/gs;
- my $file = join '/', $dir, $product;
- my $exists = -f $file;
-
- if (open DATA, ">>$file")
- {
- SendSQL ($query);
-
- my %count;
- push my @row, &today;
-
- while (my @n = FetchSQLData())
- {
- push @row, @n;
- }
-
- if (! $exists)
- {
- print DATA <<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";
+
+ $product =~ s/\//-/gs;
+ my $file = join '/', $dir, $product;
+ my $exists = -f $file;
+
+ if (open DATA, ">>$file") {
+ SendSQL ($query);
+
+ my %count;
+ push my @row, &today;
+
+ while (my @n = FetchSQLData())
+ {
+ push @row, @n;
+ }
+
+ if (! $exists)
+ {
+ print DATA <<FIN;
# Bugzilla daily bug stats
#
# do not edit me! this file is generated.
@@ -88,20 +80,17 @@ FIN
# product: $product
# created: $when
FIN
- }
-
- print DATA (join '|', @row) . "\n";
- close DATA;
- }
- else
- {
- print "$0: $file, $!";
- }
}
-sub today
- {
- my ($dom, $mon, $year) = (localtime(time))[3, 4, 5];
- return sprintf "%04d%02d%02d", 1900 + $year, ++$mon, $dom;
- }
+ print DATA (join '|', @row) . "\n";
+ close DATA;
+ } else {
+ print "$0: $file, $!";
+ }
+}
+
+sub today {
+ my ($dom, $mon, $year) = (localtime(time))[3, 4, 5];
+ return sprintf "%04d%02d%02d", 1900 + $year, ++$mon, $dom;
+}