Always display runtime info to admin.
This commit is contained in:
parent
1fe9a4fd92
commit
dd6974855a
3 changed files with 4 additions and 10 deletions
|
@ -246,6 +246,7 @@ MIG;
|
|||
tpl_add_function('startup_time', false, function (float $time = MSZ_STARTUP) {
|
||||
return microtime(true) - $time;
|
||||
});
|
||||
tpl_add_function('sql_query_count', false, [Database::class, 'queryCount']);
|
||||
|
||||
tpl_add_path(__DIR__ . '/templates');
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
use Misuzu\Database;
|
||||
use Misuzu\Twig;
|
||||
|
||||
define('MSZ_TPL_FILE_EXT', '.twig');
|
||||
|
@ -64,12 +63,6 @@ function tpl_exists(string $path): bool
|
|||
|
||||
function tpl_render(string $path, array $vars = []): string
|
||||
{
|
||||
$twig = Twig::instance();
|
||||
|
||||
if ($twig->isDebug()) {
|
||||
tpl_var('query_count', Database::queryCount());
|
||||
}
|
||||
|
||||
$path = tpl_sanitise_path($path);
|
||||
|
||||
if (count($vars)) {
|
||||
|
@ -80,5 +73,5 @@ function tpl_render(string $path, array $vars = []): string
|
|||
define('MSZ_TPL_RENDER', microtime(true));
|
||||
}
|
||||
|
||||
return $twig->render($path, $GLOBALS[MSZ_TPL_VARS_STORE]);
|
||||
return Twig::instance()->render($path, $GLOBALS[MSZ_TPL_VARS_STORE]);
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@
|
|||
''|date('Y') }} /
|
||||
{{ ('https://github.com/flashwave/misuzu/tree/' ~ git_branch())|html_link(git_branch(), 'footer__link') }}
|
||||
# {{ ('https://github.com/flashwave/misuzu/commit/' ~ git_commit_hash(true))|html_link(git_commit_hash(), 'footer__link') }}
|
||||
{% if query_count is defined %}
|
||||
/ SQL Queries: {{ query_count|number_format }}
|
||||
{% if constant('MSZ_DEBUG') or current_user.user_id|default(0) == 1 %}
|
||||
/ SQL Queries: {{ sql_query_count()|number_format }}
|
||||
/ Took: {{ startup_time()|number_format(5) }} seconds
|
||||
/ Render: {{ startup_time(constant('MSZ_TPL_RENDER'))|number_format(5) }} seconds
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in a new issue