mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 05:07:27 +02:00
Avoid displaying more than 500 sql queries during debug mode. (eg. when poorly written plugins are in use)
This commit is contained in:
@@ -264,21 +264,36 @@ class e107_db_debug {
|
|||||||
// Optionally list good queries
|
// Optionally list good queries
|
||||||
//
|
//
|
||||||
|
|
||||||
if ($okCount && E107_DBG_SQLDETAILS) {
|
if ($okCount && E107_DBG_SQLDETAILS)
|
||||||
|
{
|
||||||
$text .= "\n<table class='fborder table table-striped table-bordered'>\n";
|
$text .= "\n<table class='fborder table table-striped table-bordered'>\n";
|
||||||
$text .= "<tr><td class='fcaption' colspan='3'><b>".$this->countLabel($okCount)." Good Queries</b></td></tr>\n";
|
$text .= "<tr><td class='fcaption' colspan='3'><b>".$this->countLabel($okCount)." Good Queries</b></td></tr>\n";
|
||||||
$text .= "<tr><td class='fcaption'><b>Index</b></td><td class='fcaption'><b>Qtime</b></td><td class='fcaption'><b>Query</b></td></tr>\n
|
$text .= "<tr><td class='fcaption'><b>Index</b></td><td class='fcaption'><b>Qtime</b></td><td class='fcaption'><b>Query</b></td></tr>\n
|
||||||
<tr><td class='fcaption'> </td><td class='fcaption'><b>(msec)</b></td><td class='fcaption'> </td></tr>\n
|
<tr><td class='fcaption'> </td><td class='fcaption'><b>(msec)</b></td><td class='fcaption'> </td></tr>\n
|
||||||
";
|
";
|
||||||
|
|
||||||
|
$count = 0;
|
||||||
foreach ($this->aSQLdetails as $idx => $cQuery)
|
foreach ($this->aSQLdetails as $idx => $cQuery)
|
||||||
{
|
{
|
||||||
if ($cQuery['ok']) {
|
if($count > 500)
|
||||||
|
{
|
||||||
|
$text .= "<tr class='danger'><td colspan='6'><b>Too many queries. Ending... </b></td></tr>"; // NO LAN - debug only.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($cQuery['ok'])
|
||||||
|
{
|
||||||
$text .= "<tr><td class='forumheader3' style='text-align:right'>{$idx} </td>
|
$text .= "<tr><td class='forumheader3' style='text-align:right'>{$idx} </td>
|
||||||
<td class='forumheader3' style='text-align:right'>".number_format($cQuery['time'] * 1000.0, 4)." </td>
|
<td class='forumheader3' style='text-align:right'>".number_format($cQuery['time'] * 1000.0, 4)." </td>
|
||||||
<td class='forumheader3'>".$cQuery['query'].'<br />['.$cQuery['marker']." - ".$cQuery['caller']."]</td></tr>\n";
|
<td class='forumheader3'>".$cQuery['query'].'<br />['.$cQuery['marker']." - ".$cQuery['caller']."]</td></tr>\n";
|
||||||
|
|
||||||
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$text .= "\n</table><br />\n";
|
$text .= "\n</table><br />\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,8 +301,11 @@ class e107_db_debug {
|
|||||||
//
|
//
|
||||||
// Optionally list query details
|
// Optionally list query details
|
||||||
//
|
//
|
||||||
if (E107_DBG_SQLDETAILS) {
|
if (E107_DBG_SQLDETAILS)
|
||||||
foreach ($this->aSQLdetails as $idx => $cQuery) {
|
{
|
||||||
|
$count = 0;
|
||||||
|
foreach ($this->aSQLdetails as $idx => $cQuery)
|
||||||
|
{
|
||||||
$text .= "\n<table class='fborder table table-striped table-bordered' style='width: 100%;'>\n";
|
$text .= "\n<table class='fborder table table-striped table-bordered' style='width: 100%;'>\n";
|
||||||
$text .= "<tr><td class='forumheader3' colspan='".$cQuery['nFields']."'><b>".$idx.") Query:</b> [".$cQuery['marker']." - ".$cQuery['caller']."]<br />".$cQuery['query']."</td></tr>\n";
|
$text .= "<tr><td class='forumheader3' colspan='".$cQuery['nFields']."'><b>".$idx.") Query:</b> [".$cQuery['marker']." - ".$cQuery['caller']."]<br />".$cQuery['query']."</td></tr>\n";
|
||||||
if (isset($cQuery['explain'])) {
|
if (isset($cQuery['explain'])) {
|
||||||
@@ -300,6 +318,15 @@ class e107_db_debug {
|
|||||||
$text .= "<tr><td class='forumheader3' colspan='".$cQuery['nFields']."'><b>Query time:</b> ".number_format($cQuery['time'] * 1000.0, 4).' (ms)</td></tr>';
|
$text .= "<tr><td class='forumheader3' colspan='".$cQuery['nFields']."'><b>Query time:</b> ".number_format($cQuery['time'] * 1000.0, 4).' (ms)</td></tr>';
|
||||||
|
|
||||||
$text .= '</table><br />'."\n";
|
$text .= '</table><br />'."\n";
|
||||||
|
|
||||||
|
if($count > 500)
|
||||||
|
{
|
||||||
|
$text .= "<div class='alert alert-danger text-center'>Too many queries. Ending...</div>"; // NO LAN - debug only.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user