From 814b24fdc9407a741967322041ff817665f8e00b Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Wed, 7 Jul 2010 03:58:10 +0200 Subject: Bug 519835: Remove Bugzilla::Product::check_product() in favor of Bugzilla::Product->check() r=mkanat a=LpSolit --- collectstats.pl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'collectstats.pl') 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; -- cgit v1.2.3-24-g4f1b