diff options
author | lpsolit%gmail.com <> | 2007-08-21 01:04:19 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2007-08-21 01:04:19 +0200 |
commit | 5818051fbeb4aec81dd2b9ab861d149ee2f2e10f (patch) | |
tree | 6a09df91fb480c70d8b177e7fe0434c5b7447c65 /collectstats.pl | |
parent | ae89fa815ac5b6ee314c9f1194179db1c47f5abc (diff) | |
download | bugzilla-5818051fbeb4aec81dd2b9ab861d149ee2f2e10f.tar.gz bugzilla-5818051fbeb4aec81dd2b9ab861d149ee2f2e10f.tar.xz |
Bug 257351: collectstats.pl dies if an invalid series is defined - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 'collectstats.pl')
-rwxr-xr-x | collectstats.pl | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/collectstats.pl b/collectstats.pl index 730b8c50f..a1ab9b2d1 100755 --- a/collectstats.pl +++ b/collectstats.pl @@ -579,22 +579,19 @@ sub CollectSeriesData { # We set up the user for Search.pm's permission checking - each series # runs with the permissions of its creator. my $user = new Bugzilla::User($serieses->{$series_id}->{'creator'}); - my $cgi = new Bugzilla::CGI($serieses->{$series_id}->{'query'}); - my $search = new Bugzilla::Search('params' => $cgi, - 'fields' => ["bugs.bug_id"], - 'user' => $user); - my $sql = $search->getSQL(); - my $data; - - # We can't die if we get dodgy SQL back for whatever reason, so we - # eval() this and, if it fails, just ignore it and carry on. - # One day we might even log an error. - eval { + + # Do not die if Search->new() detects invalid data, such as an obsolete + # login name or a renamed product or component, etc. + eval { + my $search = new Bugzilla::Search('params' => $cgi, + 'fields' => ["bugs.bug_id"], + 'user' => $user); + my $sql = $search->getSQL(); $data = $shadow_dbh->selectall_arrayref($sql); }; - + if (!$@) { # We need to count the returned rows. Without subselects, we can't # do this directly in the SQL for all queries. So we do it by hand. |