Adds a notice for maintenance mode for superusers
parent
692fec9bfe
commit
3695761b9e
|
@ -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';
|
||||
|
|
|
@ -250,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