Fixed maintenance page assets for subpaths and send 503 Service Unavailable

main
Igor Scheller 3 years ago committed by msquare
parent bf1ea07eab
commit 6c288bceb5

@ -3,6 +3,9 @@
/** /**
* Bootstrap application * Bootstrap application
*/ */
use Engelsystem\Http\UrlGeneratorInterface;
require __DIR__ . '/application.php'; require __DIR__ . '/application.php';
@ -16,8 +19,11 @@ require __DIR__ . '/includes.php';
* Check for maintenance * Check for maintenance
*/ */
if ($app->get('config')->get('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 = file_get_contents(__DIR__ . '/../resources/views/layouts/maintenance.html');
$maintenance = str_replace('%APP_NAME%', $app->get('config')->get('app_name'), $maintenance); $maintenance = str_replace('%APP_NAME%', $app->get('config')->get('app_name'), $maintenance);
$maintenance = str_replace('%ASSETS_PATH%', $url->to(''), $maintenance);
echo $maintenance; echo $maintenance;
die(); die();
} }

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

Loading…
Cancel
Save