Adds a notice for maintenance mode for superusers
parent
692fec9bfe
commit
3695761b9e
|
@ -143,6 +143,10 @@ class Feedback {
|
||||||
'type' => self::TYPE_WARNING,
|
'type' => self::TYPE_WARNING,
|
||||||
'dismissible' => true
|
'dismissible' => true
|
||||||
],
|
],
|
||||||
|
'MAINTENANCE_ON' => [
|
||||||
|
'type' => self::TYPE_WARNING,
|
||||||
|
'dismissible' => false
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
private static $strings = null;
|
private static $strings = null;
|
||||||
|
|
|
@ -45,5 +45,6 @@ return [
|
||||||
'DB_CONNECT_ERROR' => 'Error connecting to DB: %s',
|
'DB_CONNECT_ERROR' => 'Error connecting to DB: %s',
|
||||||
'DB_UNKNOWN_TYPE' => 'Error: unknown database type "%s"',
|
'DB_UNKNOWN_TYPE' => 'Error: unknown database type "%s"',
|
||||||
'MIGRATIONS_PENDING' => '%s',
|
'MIGRATIONS_PENDING' => '%s',
|
||||||
|
'MAINTENANCE_ON' => 'Maintenance mode is enabled. Regular users see a maintenance page.',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
|
@ -28,6 +28,9 @@ if (!$canAdmin) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get any old feedback messages
|
||||||
|
include __DIR__ . '/../helpers/feedback.php';
|
||||||
|
|
||||||
// Handle actions
|
// Handle actions
|
||||||
$action = $_POST['action'] ?? '';
|
$action = $_POST['action'] ?? '';
|
||||||
|
|
||||||
|
@ -141,8 +144,5 @@ try {
|
||||||
// CSRF token
|
// CSRF token
|
||||||
$csrf_token = $security->generateCsrfToken();
|
$csrf_token = $security->generateCsrfToken();
|
||||||
|
|
||||||
// Get any new feedback messages
|
|
||||||
include __DIR__ . '/../helpers/feedback.php';
|
|
||||||
|
|
||||||
// Load the template
|
// Load the template
|
||||||
include __DIR__ . '/../templates/admin-tools.php';
|
include __DIR__ . '/../templates/admin-tools.php';
|
||||||
|
|
|
@ -250,6 +250,16 @@ try {
|
||||||
\App\Helpers\Theme::include('page-footer');
|
\App\Helpers\Theme::include('page-footer');
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
exit;
|
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) {
|
} catch (\Throwable $e) {
|
||||||
|
|
Loading…
Reference in New Issue