From 6c288bceb51306e4366675408b255049fa7c110f Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Fri, 3 Dec 2021 23:27:11 +0100 Subject: [PATCH] Fixed maintenance page assets for subpaths and send 503 Service Unavailable --- includes/engelsystem.php | 6 ++++++ resources/views/layouts/maintenance.html | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/engelsystem.php b/includes/engelsystem.php index ca121cc2..acd45f77 100644 --- a/includes/engelsystem.php +++ b/includes/engelsystem.php @@ -3,6 +3,9 @@ /** * Bootstrap application */ + +use Engelsystem\Http\UrlGeneratorInterface; + require __DIR__ . '/application.php'; @@ -16,8 +19,11 @@ require __DIR__ . '/includes.php'; * Check for maintenance */ if ($app->get('config')->get('maintenance')) { + http_response_code(503); + $url = $app->get(UrlGeneratorInterface::class); $maintenance = file_get_contents(__DIR__ . '/../resources/views/layouts/maintenance.html'); $maintenance = str_replace('%APP_NAME%', $app->get('config')->get('app_name'), $maintenance); + $maintenance = str_replace('%ASSETS_PATH%', $url->to(''), $maintenance); echo $maintenance; die(); } diff --git a/resources/views/layouts/maintenance.html b/resources/views/layouts/maintenance.html index c2473b70..0fc6a213 100644 --- a/resources/views/layouts/maintenance.html +++ b/resources/views/layouts/maintenance.html @@ -4,8 +4,8 @@ Maintenance - %APP_NAME% - - + +