aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-08-20 23:06:45 +0000
committerlpsolit%gmail.com <>2007-08-20 23:06:45 +0000
commitc8154661f5f5ca15332c398064ae44c3aecc177a (patch)
tree29df509147bcf3dff8a5fad1af8c07b8cc9da1e2
parentBug 392573 – Most CSS files are missing from Dusk/, flooding web server ... (diff)
downloadbugzilla-c8154661f5f5ca15332c398064ae44c3aecc177a.tar.gz
bugzilla-c8154661f5f5ca15332c398064ae44c3aecc177a.tar.bz2
bugzilla-c8154661f5f5ca15332c398064ae44c3aecc177a.zip
Bug 257351: collectstats.pl dies if an invalid series is defined - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
-rw-r--r--Bugzilla/DB.pm2
-rwxr-xr-xcollectstats.pl21
2 files changed, 10 insertions, 13 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 4bfb3ae43..b4f659685 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -321,7 +321,7 @@ sub sql_group_by {
my ($self, $needed_columns, $optional_columns) = @_;
my $expression = "GROUP BY $needed_columns";
- $expression .= ", " . $optional_columns if defined($optional_columns);
+ $expression .= ", " . $optional_columns if $optional_columns;
return $expression;
}
diff --git a/collectstats.pl b/collectstats.pl
index 3702a472b..80c70fe2b 100755
--- a/collectstats.pl
+++ b/collectstats.pl
@@ -575,22 +575,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.