From 7ef9d5bb8be67e5bfa611eb19e2fcd349289c38a Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 26 Oct 2005 23:52:18 +0000 Subject: Bug 150105: $debug flag in buglist.cgi not working - Patch by Teemu Mannermaa r=LpSolit a=myk --- Bugzilla/Search.pm | 22 ++++++++++++++-------- buglist.cgi | 1 + template/en/default/list/list.html.tmpl | 5 +++++ template/en/default/list/server-push.html.tmpl | 5 +++++ 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 5a651a3b5..ebccdb51e 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -102,6 +102,8 @@ sub init { my @orderby; my $debug = 0; + my @debugdata; + if ($params->param('debug')) { $debug = 1; } my @fields; my @supptables; @@ -1160,7 +1162,9 @@ sub init { $params->param("type$chart-$row-$col", shift(@$ref)); $params->param("value$chart-$row-$col", shift(@$ref)); if ($debug) { - print qq{

$params->param("field$chart-$row-$col") | $params->param("type$chart-$row-$col") | $params->param("value$chart-$row-$col")*

\n}; + push(@debugdata, "$row-$col = " . + $params->param("field$chart-$row-$col") . ' | ' . $params->param("type$chart-$row-$col") . ' | ' . + $params->param("value$chart-$row-$col") . ' *'); } $col++; @@ -1298,7 +1302,7 @@ sub init { if ("$f,$t,$rhs" =~ m/$key/) { my $ref = $funcsbykey{$key}; if ($debug) { - print "

$key ($f , $t , $rhs ) => "; + push(@debugdata, "$key ($f / $t / $rhs) =>"); } $ff = $f; if ($f !~ /\./) { @@ -1306,7 +1310,8 @@ sub init { } &$ref; if ($debug) { - print "$f , $t , $v , $term

"; + push(@debugdata, "$f / $t / $v / " . + ($term || "undef") . " *"); } if ($term) { last; @@ -1436,12 +1441,8 @@ sub init { $query .= " ORDER BY " . join(',', @orderby); } - if ($debug) { - print "

" . value_quote($query) . "

\n"; - exit; - } - $self->{'sql'} = $query; + $self->{'debugdata'} = \@debugdata; } ############################################################################### @@ -1601,6 +1602,11 @@ sub getSQL { return $self->{'sql'}; } +sub getDebugData { + my $self = shift; + return $self->{'debugdata'}; +} + sub pronoun { my ($noun, $user) = (@_); if ($noun eq "%user%") { diff --git a/buglist.cgi b/buglist.cgi index cb49d2a31..386253556 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -847,6 +847,7 @@ elsif ($fulltext) { if ($cgi->param('debug')) { $vars->{'debug'} = 1; $vars->{'query'} = $query; + $vars->{'debugdata'} = $search->getDebugData(); } # Time to use server push to display an interim message to the user until diff --git a/template/en/default/list/list.html.tmpl b/template/en/default/list/list.html.tmpl index 48b60ac8a..5c2e0312a 100644 --- a/template/en/default/list/list.html.tmpl +++ b/template/en/default/list/list.html.tmpl @@ -59,6 +59,11 @@ [% END %] [% IF debug %] +

+ [% FOREACH debugline = debugdata %] + [% debugline FILTER html %]
+ [% END %] +

[% query FILTER html %]

[% END %] diff --git a/template/en/default/list/server-push.html.tmpl b/template/en/default/list/server-push.html.tmpl index 4fb88e9b4..be7a63c56 100644 --- a/template/en/default/list/server-push.html.tmpl +++ b/template/en/default/list/server-push.html.tmpl @@ -34,6 +34,11 @@

Please stand by ...

[% IF debug %] +

+ [% FOREACH debugline = debugdata %] + [% debugline FILTER html %]
+ [% END %] +

[% query FILTER html %]

-- cgit v1.2.3-24-g4f1b