diff options
Diffstat (limited to 'collectstats.pl')
-rwxr-xr-x | collectstats.pl | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/collectstats.pl b/collectstats.pl index 733a1e4f1..af055ab32 100755 --- a/collectstats.pl +++ b/collectstats.pl @@ -70,9 +70,6 @@ if ($#ARGV >= 0 && $ARGV[0] eq "--regenerate") { my $datadir = bz_locations()->{'datadir'}; -my @myproducts = map {$_->name} Bugzilla::Product->get_all; -unshift(@myproducts, "-All-"); - # As we can now customize statuses and resolutions, looking at the current list # of legal values only is not enough as some now removed statuses and resolutions # may have existed in the past, or have been renamed. We want them all. @@ -142,6 +139,10 @@ if ($regenerate) { } my $tstart = time; + +my @myproducts = Bugzilla::Product->get_all; +unshift(@myproducts, "-All-"); + foreach (@myproducts) { my $dir = "$datadir/mining"; @@ -173,11 +174,11 @@ sub collect_stats { my $product = shift; my $when = localtime (time); my $dbh = Bugzilla->dbh; - my $product_id; - if ($product ne '-All-') { - my $prod = Bugzilla::Product::check_product($product); - $product_id = $prod->id; + + if (ref $product) { + $product_id = $product->id; + $product = $product->name; } # NB: Need to mangle the product for the filename, but use the real @@ -312,6 +313,9 @@ sub regenerate_stats { # NB: Need to mangle the product for the filename, but use the real # product name in the query + if (ref $product) { + $product = $product->name; + } my $file_product = $product; $file_product =~ s/\//-/gs; my $file = join '/', $dir, $file_product; |