summaryrefslogtreecommitdiff
path: root/src/index.php
diff options
context:
space:
mode:
authorJonas Kohl2024-12-22 13:06:42 +0100
committerJonas Kohl2024-12-22 13:06:42 +0100
commit08e4128ddce9dcffe0a4224ae57ad664609935b2 (patch)
tree87f5160bfa5203d46c5c301d530e51d11cf5efe7 /src/index.php
parentbf15bdf4639c61d9855cc76b4e58463eabbd6760 (diff)
Add statisticsv0.7.0
Diffstat (limited to 'src/index.php')
-rw-r--r--src/index.php3
1 files changed, 3 insertions, 0 deletions
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;