From 6dd61638332fa489bd84fa3e6726c7c5d10986f6 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Wed, 16 Oct 2013 19:45:57 +0200 Subject: [PATCH] Added SQL query count in footer --- lib/redbean | 2 +- src/Views/layout-normal.phtml | 2 ++ src/core.php | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/redbean b/lib/redbean index 00af42a5..95cf7d23 160000 --- a/lib/redbean +++ b/lib/redbean @@ -1 +1 @@ -Subproject commit 00af42a541dc1887db0c5ac4182db0ecc493316f +Subproject commit 95cf7d231b60acdeee050041d44503df1b288b74 diff --git a/src/Views/layout-normal.phtml b/src/Views/layout-normal.phtml index 26fd5311..abb1fc75 100644 --- a/src/Views/layout-normal.phtml +++ b/src/Views/layout-normal.phtml @@ -99,6 +99,8 @@ diff --git a/src/core.php b/src/core.php index d7a7d2c9..53fefa99 100644 --- a/src/core.php +++ b/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();