Commit 7ef9d5bb authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 150105: $debug flag in buglist.cgi not working - Patch by Teemu Mannermaa…

Bug 150105: $debug flag in buglist.cgi not working - Patch by Teemu Mannermaa <wicked@etlicon.fi> r=LpSolit a=myk
parent 17425864
...@@ -102,6 +102,8 @@ sub init { ...@@ -102,6 +102,8 @@ sub init {
my @orderby; my @orderby;
my $debug = 0; my $debug = 0;
my @debugdata;
if ($params->param('debug')) { $debug = 1; }
my @fields; my @fields;
my @supptables; my @supptables;
...@@ -1160,7 +1162,9 @@ sub init { ...@@ -1160,7 +1162,9 @@ sub init {
$params->param("type$chart-$row-$col", shift(@$ref)); $params->param("type$chart-$row-$col", shift(@$ref));
$params->param("value$chart-$row-$col", shift(@$ref)); $params->param("value$chart-$row-$col", shift(@$ref));
if ($debug) { if ($debug) {
print qq{<p>$params->param("field$chart-$row-$col") | $params->param("type$chart-$row-$col") | $params->param("value$chart-$row-$col")*</p>\n}; push(@debugdata, "$row-$col = " .
$params->param("field$chart-$row-$col") . ' | ' . $params->param("type$chart-$row-$col") . ' | ' .
$params->param("value$chart-$row-$col") . ' *');
} }
$col++; $col++;
...@@ -1298,7 +1302,7 @@ sub init { ...@@ -1298,7 +1302,7 @@ sub init {
if ("$f,$t,$rhs" =~ m/$key/) { if ("$f,$t,$rhs" =~ m/$key/) {
my $ref = $funcsbykey{$key}; my $ref = $funcsbykey{$key};
if ($debug) { if ($debug) {
print "<p>$key ($f , $t , $rhs ) => "; push(@debugdata, "$key ($f / $t / $rhs) =>");
} }
$ff = $f; $ff = $f;
if ($f !~ /\./) { if ($f !~ /\./) {
...@@ -1306,7 +1310,8 @@ sub init { ...@@ -1306,7 +1310,8 @@ sub init {
} }
&$ref; &$ref;
if ($debug) { if ($debug) {
print "$f , $t , $v , $term</p>"; push(@debugdata, "$f / $t / $v / " .
($term || "undef") . " *");
} }
if ($term) { if ($term) {
last; last;
...@@ -1436,12 +1441,8 @@ sub init { ...@@ -1436,12 +1441,8 @@ sub init {
$query .= " ORDER BY " . join(',', @orderby); $query .= " ORDER BY " . join(',', @orderby);
} }
if ($debug) {
print "<p><code>" . value_quote($query) . "</code></p>\n";
exit;
}
$self->{'sql'} = $query; $self->{'sql'} = $query;
$self->{'debugdata'} = \@debugdata;
} }
############################################################################### ###############################################################################
...@@ -1601,6 +1602,11 @@ sub getSQL { ...@@ -1601,6 +1602,11 @@ sub getSQL {
return $self->{'sql'}; return $self->{'sql'};
} }
sub getDebugData {
my $self = shift;
return $self->{'debugdata'};
}
sub pronoun { sub pronoun {
my ($noun, $user) = (@_); my ($noun, $user) = (@_);
if ($noun eq "%user%") { if ($noun eq "%user%") {
......
...@@ -847,6 +847,7 @@ elsif ($fulltext) { ...@@ -847,6 +847,7 @@ elsif ($fulltext) {
if ($cgi->param('debug')) { if ($cgi->param('debug')) {
$vars->{'debug'} = 1; $vars->{'debug'} = 1;
$vars->{'query'} = $query; $vars->{'query'} = $query;
$vars->{'debugdata'} = $search->getDebugData();
} }
# Time to use server push to display an interim message to the user until # Time to use server push to display an interim message to the user until
......
...@@ -59,6 +59,11 @@ ...@@ -59,6 +59,11 @@
[% END %] [% END %]
[% IF debug %] [% IF debug %]
<p>
[% FOREACH debugline = debugdata %]
[% debugline FILTER html %]<br>
[% END %]
</p>
<p>[% query FILTER html %]</p> <p>[% query FILTER html %]</p>
[% END %] [% END %]
......
...@@ -35,6 +35,11 @@ ...@@ -35,6 +35,11 @@
[% IF debug %] [% IF debug %]
<p> <p>
[% FOREACH debugline = debugdata %]
<code>[% debugline FILTER html %]</code><br>
[% END %]
</p>
<p>
<code>[% query FILTER html %]</code> <code>[% query FILTER html %]</code>
</p> </p>
[% END %] [% END %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment