Added SQL query count in footer
This commit is contained in:
parent
42782258cc
commit
6dd6163833
3 changed files with 13 additions and 1 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 00af42a541dc1887db0c5ac4182db0ecc493316f
|
||||
Subproject commit 95cf7d231b60acdeee050041d44503df1b288b74
|
|
@ -99,6 +99,8 @@
|
|||
<footer>
|
||||
<div class="main-wrapper">
|
||||
Load: <?php echo sprintf('%.05f', microtime(true) - trueStartTime()) ?>s
|
||||
|
||||
Queries: <?php echo count(queryLogger()->getLogs()) ?>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
|
|
10
src/core.php
10
src/core.php
|
@ -10,6 +10,7 @@ trueStartTime();
|
|||
|
||||
require_once 'lib/redbean/RedBean/redbean.inc.php';
|
||||
require_once 'lib/chibi-core/Facade.php';
|
||||
require_once 'lib/chibi-core/Registry.php';
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
setlocale(LC_CTYPE, 'en_US.UTF-8');
|
||||
|
@ -48,3 +49,12 @@ R::dependencies(['tag' => ['post'], 'favoritee' => ['post', 'user']]);
|
|||
foreach (\Chibi\AutoLoader::getAllIncludablePaths() as $path)
|
||||
if (preg_match('/Model/', $path))
|
||||
\Chibi\AutoLoader::safeInclude($path);
|
||||
|
||||
function queryLogger()
|
||||
{
|
||||
static $queryLogger = null;
|
||||
if ($queryLogger === null)
|
||||
$queryLogger = RedBean_Plugin_QueryLogger::getInstanceAndAttach(R::getDatabaseAdapter());
|
||||
return $queryLogger;
|
||||
}
|
||||
queryLogger();
|
||||
|
|
Loading…
Reference in a new issue