diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/application/appdef.php | 2 | ||||
-rw-r--r-- | src/application/templates/old/base.twig | 3 | ||||
-rw-r--r-- | src/index.php | 9 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/application/appdef.php b/src/application/appdef.php index 6c69ee8..1f51d97 100644 --- a/src/application/appdef.php +++ b/src/application/appdef.php @@ -1,3 +1,3 @@ <?php -const MYSTICBB_VERSION = "0.7.0"; +const MYSTICBB_VERSION = "0.7.1"; diff --git a/src/application/templates/old/base.twig b/src/application/templates/old/base.twig index bdb9768..bbac643 100644 --- a/src/application/templates/old/base.twig +++ b/src/application/templates/old/base.twig @@ -80,6 +80,9 @@ {{ __("Number of database queries: %count%", { count: getQueryCount(), }) }} + {% if constant("DEBUG") == true %} + <br><font color="red"><b>Debug mode</b></font> + {% endif %} </td> <td align="right"> <table><tr><td> diff --git a/src/index.php b/src/index.php index 5350680..8036a19 100644 --- a/src/index.php +++ b/src/index.php @@ -27,6 +27,7 @@ if (($_SERVER["HTTP_USER_AGENT"] ?? "") === "") { } define("REGISTRATION_ENABLED", isTrue(env("REGISTRATION_ENABLED") ?? "")); +define("DEBUG", isTrue(env("DEBUG") ?? "")); const __ROOT__ = __DIR__; @@ -172,9 +173,11 @@ function render(string $page, array $context = [], array $functions = []): void $loader = new FilesystemLoader([ $templateDir . "/" . $currentTemplate, ]); - $twig = new Environment($loader, [ - // TODO Enable caching - ]); + $twigEnvConfig = []; + if (!DEBUG) { + $twigEnvConfig["cache"] = sys_get_temp_dir() . DIRECTORY_SEPARATOR . "mybb-template-cache"; + } + $twig = new Environment($loader, $twigEnvConfig); $twig->addFunction(new TwigFunction("__", __(...), [ "is_safe" => ["html"] ])); $twig->addFunction(new TwigFunction("___", ___(...), [ "is_safe" => ["html"] ])); |