Version 5.0.0 beta 5
This commit is contained in:
1 parent
2f24f9de48
commit
57d9db6ce2
218 files changed
+5331
-7416
No files matched your search
@@ -12,6 +12,7 @@ namespace IPS\Output;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Output;
|
||||
@@ -176,6 +177,9 @@ class System extends Output
|
||||
cursor: pointer;
|
||||
color: blue;
|
||||
}
|
||||
tr.explain-table {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function toggleRow(id) {
|
||||
@@ -214,6 +218,36 @@ HTML;
|
||||
foreach ($debug as $index => $data)
|
||||
{
|
||||
$unique = md5( $data['query'] . uniqid() );
|
||||
$explain = null;
|
||||
$explainHtml = '';
|
||||
|
||||
/* If this is a select query, we can get the explain */
|
||||
if ( stripos( $data['query'], 'SELECT' ) !== false )
|
||||
{
|
||||
if( $result = Db::i()->query( "EXPLAIN " . $data['query'] ) )
|
||||
{
|
||||
$explain = $result->fetch_assoc();
|
||||
}
|
||||
}
|
||||
|
||||
if ( $explain )
|
||||
{
|
||||
$explainHtml = '<table class="explain"><tr>';
|
||||
foreach( array_keys( $explain ) as $header )
|
||||
{
|
||||
$explainHtml .= "<th>{$header}</th>";
|
||||
}
|
||||
$explainHtml .= '</tr><tr>';
|
||||
|
||||
foreach( $explain as $key => $value )
|
||||
{
|
||||
$explainHtml .= "<td>{$value}</td>";
|
||||
}
|
||||
|
||||
$explainHtml .= '</tr></table>';
|
||||
}
|
||||
|
||||
|
||||
$html .= <<<HTML
|
||||
<tr>
|
||||
<td data-query="{$unique}" colspan="3" class="query">{$data['query']}</td>
|
||||
@@ -227,21 +261,28 @@ HTML;
|
||||
$trace['line'] = $trace['line'] ?? '';
|
||||
$html .= <<<HTML
|
||||
<tr data-row="content-{$unique}" style="display: none" class="collapsible-content">
|
||||
<td>
|
||||
{$trace['function']}
|
||||
</td>
|
||||
<td>
|
||||
{$trace['file']}
|
||||
</td>
|
||||
<td>
|
||||
{$trace['line']}
|
||||
</td>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<td>
|
||||
{$trace['function']}
|
||||
</td>
|
||||
<td>
|
||||
{$trace['file']}
|
||||
</td>
|
||||
<td>
|
||||
{$trace['line']}
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
HTML;
|
||||
}
|
||||
|
||||
$html .= <<<HTML
|
||||
<tr data-row="content-{$unique}" style="display: none" class="collapsible-content explain-table">
|
||||
<td colspan="4">
|
||||
{$explainHtml}
|
||||
</td>
|
||||
</tr>
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
$html .= <<<HTML
|
||||
|
||||
Reference in new issue
Block a user