Compare commits
3 Commits
5f9a0fe75b
...
d90320f5f9
| Author | SHA1 | Date |
|---|---|---|
|
|
d90320f5f9 | |
|
|
3695761b9e | |
|
|
692fec9bfe |
|
|
@ -143,6 +143,10 @@ class Feedback {
|
|||
'type' => self::TYPE_WARNING,
|
||||
'dismissible' => true
|
||||
],
|
||||
'MAINTENANCE_ON' => [
|
||||
'type' => self::TYPE_WARNING,
|
||||
'dismissible' => false
|
||||
],
|
||||
];
|
||||
|
||||
private static $strings = null;
|
||||
|
|
|
|||
|
|
@ -45,5 +45,6 @@ return [
|
|||
'DB_CONNECT_ERROR' => 'Error connecting to DB: %s',
|
||||
'DB_UNKNOWN_TYPE' => 'Error: unknown database type "%s"',
|
||||
'MIGRATIONS_PENDING' => '%s',
|
||||
'MAINTENANCE_ON' => 'Maintenance mode is enabled. Regular users see a maintenance page.',
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ if (!$canAdmin) {
|
|||
exit;
|
||||
}
|
||||
|
||||
// Get any old feedback messages
|
||||
include __DIR__ . '/../helpers/feedback.php';
|
||||
|
||||
// Handle actions
|
||||
$action = $_POST['action'] ?? '';
|
||||
|
||||
|
|
@ -141,8 +144,5 @@ try {
|
|||
// CSRF token
|
||||
$csrf_token = $security->generateCsrfToken();
|
||||
|
||||
// Get any new feedback messages
|
||||
include __DIR__ . '/../helpers/feedback.php';
|
||||
|
||||
// Load the template
|
||||
include __DIR__ . '/../templates/admin-tools.php';
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ if (!Session::isValidSession()) {
|
|||
exit;
|
||||
}
|
||||
|
||||
// Get any old feedback messages
|
||||
include '../app/helpers/feedback.php';
|
||||
|
||||
// Handle theme switching
|
||||
if (isset($_GET['switch_to'])) {
|
||||
$themeName = $_GET['switch_to'];
|
||||
|
|
@ -64,8 +67,5 @@ $themes = $themeData;
|
|||
// Generate CSRF token for the form
|
||||
$csrf_token = $security->generateCsrfToken();
|
||||
|
||||
// Get any new feedback messages
|
||||
include '../app/helpers/feedback.php';
|
||||
|
||||
// Load the template
|
||||
include '../app/templates/theme.php';
|
||||
|
|
|
|||
|
|
@ -241,6 +241,8 @@ try {
|
|||
}
|
||||
if (!$isSuperuser) {
|
||||
http_response_code(503);
|
||||
// Advise clients to retry after 10 minutes (600 seconds; configure here)
|
||||
header('Retry-After: 600');
|
||||
// Show themed maintenance page
|
||||
\App\Helpers\Theme::include('page-header');
|
||||
\App\Helpers\Theme::include('page-menu');
|
||||
|
|
@ -248,6 +250,16 @@ try {
|
|||
\App\Helpers\Theme::include('page-footer');
|
||||
ob_end_flush();
|
||||
exit;
|
||||
} else {
|
||||
// Superusers bypass maintenance; show a small banner
|
||||
$maintMsg = \App\Core\Maintenance::getMessage();
|
||||
$custom = 'Maintenance mode is enabled.';
|
||||
if (!empty($maintMsg)) {
|
||||
$custom .= ' <em>' . htmlspecialchars($maintMsg) . '</em>';
|
||||
}
|
||||
$custom .= ' Control it in <a href="' . htmlspecialchars($app_root) . '?page=admin-tools">Admin tools</a>';
|
||||
// Non-dismissible and small, do not sanitize to allow link and <em>
|
||||
Feedback::flash('SYSTEM', 'MAINTENANCE_ON', $custom, false, true, false);
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue