Add query log debugging via a constant flag

This commit is contained in:
Sky Johnson 2024-12-13 16:52:03 -06:00
parent 67045c8c8d
commit 93638f65d4
2 changed files with 6 additions and 2 deletions

View File

@ -2,9 +2,10 @@
require_once __DIR__ . '/database.php'; require_once __DIR__ . '/database.php';
define('VERSION', '1.2.3'); define('VERSION', '1.2.5');
define('BUILD', 'Reawaken'); define('BUILD', 'Reawaken');
define('START', microtime(true)); define('START', microtime(true));
define('DEBUG', true);
/** /**
* Open or get SQLite database connection. * Open or get SQLite database connection.
@ -211,7 +212,8 @@ function display($content, $title, $topnav=true, $leftnav=true, $rightnav=true,
"totaltime" => round(getmicrotime() - START, 4), "totaltime" => round(getmicrotime() - START, 4),
"numqueries" => db()->count, "numqueries" => db()->count,
"version" => VERSION, "version" => VERSION,
"build" => BUILD "build" => BUILD,
"querylog" => DEBUG ? '<pre>'.print_r(db()->log, true).'</pre>' : ''
]); ]);
echo "<html>\n" . $page; echo "<html>\n" . $page;

View File

@ -38,6 +38,8 @@ $template = <<<HTML
<div>{{totaltime}} Seconds, {{numqueries}} Queries</div> <div>{{totaltime}} Seconds, {{numqueries}} Queries</div>
<div>Version {{version}} {{build}}</div> <div>Version {{version}} {{build}}</div>
</footer> </footer>
{{querylog}}
</div> </div>
</body> </body>
</html> </html>