Fixed maintenance page assets for subpaths and send 503 Service Unavailable

This commit is contained in:
Igor Scheller 2021-12-03 23:27:11 +01:00 committed by msquare
parent bf1ea07eab
commit 6c288bceb5
2 changed files with 8 additions and 2 deletions

View File

@ -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();
}

View File

@ -4,8 +4,8 @@
<title>Maintenance - %APP_NAME%</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="assets/theme0.css"/>
<script type="text/javascript" src="assets/vendor.js"></script>
<link rel="stylesheet" type="text/css" href="%ASSETS_PATH%/assets/theme0.css"/>
<script type="text/javascript" src="%ASSETS_PATH%/assets/vendor.js"></script>
</head>
<body>
<div class="navbar navbar-light bg-light fixed-top">