From 08e4128ddce9dcffe0a4224ae57ad664609935b2 Mon Sep 17 00:00:00 2001 From: Jonas Kohl Date: Sun, 22 Dec 2024 13:06:42 +0100 Subject: Add statistics --- src/index.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/index.php') diff --git a/src/index.php b/src/index.php index b7e0397..5350680 100644 --- a/src/index.php +++ b/src/index.php @@ -17,6 +17,7 @@ use Twig\TwigFilter; use Twig\TwigFunction; header_remove("X-Powered-By"); +$GLOBALS["startTime"] = microtime(true); include __DIR__ . "/application/appdef.php"; @@ -181,6 +182,8 @@ function render(string $page, array $context = [], array $functions = []): void $twig->addFunction(new TwigFunction("renderPostSummary", renderPostSummary(...), [ "is_safe" => ["html"] ])); $twig->addFunction(new TwigFunction("permission", fn(string $name): int => constant(UserPermissions::class . "::" . $name))); $twig->addFunction(new TwigFunction("getAndClearFormError", RequestUtils::getAndClearFormError(...))); + $twig->addFunction(new TwigFunction("getQueryCount", $GLOBALS["db"]->getQueryCount(...))); + $twig->addFunction(new TwigFunction("getRunTime", fn() => microtime(true) - $GLOBALS["startTime"])); $twig->addFunction(new TwigFunction("lastFormField", function(string $formId, string $field): ?string { $lastFormId = ""; $lastForm = RequestUtils::getLastForm($lastFormId) ?? null; -- cgit v1.2.3