szurubooru/src/Views/debug.phtml

25 lines
901 B
PHTML
Raw Normal View History

2014-02-27 15:04:36 +01:00
<?php CustomAssetViewDecorator::addStylesheet('debug.css') ?>
2014-02-24 15:33:53 +01:00
<div class="main-wrapper">
<?php foreach (\Chibi\Database::getLogs() as $log): ?>
2014-02-24 15:33:53 +01:00
<div class="debug">
<?php
$query = $log->getStatement()->getAsString();
2014-02-24 15:33:53 +01:00
$query = str_replace('(', '<span>(', $query);
$query = str_replace(')', ')</span>', $query);
?>
<pre class="query"><?php echo $query ?></pre>
<pre class="bindings"><?php echo join(', ', array_map(function($key) use ($log)
{
return $key . '=<span class="value">' . $log->getStatement()->getBindings()[$key] . '</span>';
2014-02-24 15:33:53 +01:00
},
array_keys($log->getStatement()->getBindings()))) ?></pre>
2014-02-24 15:33:53 +01:00
<table>
<tr><td>Execution:</td><td><?php echo sprintf('%.05fs', $log->getExecutionTime()) ?></td></tr>
<tr><td>Retrieval:</td><td><?php echo sprintf('%.05fs', $log->getRetrievalTime()) ?></td></tr>
2014-02-24 15:33:53 +01:00
</table>
</div>
<?php endforeach ?>
</div>