Removed application folder (Ci3) added maintenance mode
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use CodeIgniter\CLI\BaseCommand;
|
||||
use CodeIgniter\CLI\CLI;
|
||||
|
||||
class Down extends BaseCommand
|
||||
{
|
||||
protected $group = 'Housekeeping';
|
||||
protected $name = 'down';
|
||||
protected $description = 'Put the application into maintenance mode.';
|
||||
protected $usage = 'down [options]';
|
||||
protected $options = [
|
||||
'--allow' => 'IP address(es) to whitelist (comma-separated or use multiple --allow)',
|
||||
'--message' => 'Custom message for the maintenance page',
|
||||
];
|
||||
|
||||
public function run(array $params)
|
||||
{
|
||||
$allowedIps = [];
|
||||
|
||||
// Get allowed IPs from command line
|
||||
if (CLI::getOption('allow')) {
|
||||
$allow = CLI::getOption('allow');
|
||||
if (is_array($allow)) {
|
||||
foreach ($allow as $ip) {
|
||||
$allowedIps = array_merge($allowedIps, array_map('trim', explode(',', $ip)));
|
||||
}
|
||||
} else {
|
||||
$allowedIps = array_map('trim', explode(',', $allow));
|
||||
}
|
||||
}
|
||||
|
||||
// Get custom message
|
||||
$message = CLI::getOption('message') ?: '';
|
||||
|
||||
// Create maintenance data
|
||||
$data = [
|
||||
'time' => date('Y-m-d H:i:s'),
|
||||
'allowed' => array_values(array_filter($allowedIps)),
|
||||
'message' => $message,
|
||||
];
|
||||
|
||||
$filePath = WRITEPATH . 'down';
|
||||
|
||||
if (file_put_contents($filePath, json_encode($data, JSON_PRETTY_PRINT))) {
|
||||
CLI::write('Application is now in maintenance mode.', 'yellow');
|
||||
|
||||
if (! empty($allowedIps)) {
|
||||
CLI::write('Whitelisted IPs: ' . implode(', ', $allowedIps), 'green');
|
||||
}
|
||||
} else {
|
||||
CLI::error('Failed to enable maintenance mode. Check writable directory permissions.');
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use CodeIgniter\CLI\BaseCommand;
|
||||
use CodeIgniter\CLI\CLI;
|
||||
|
||||
class Up extends BaseCommand
|
||||
{
|
||||
protected $group = 'Housekeeping';
|
||||
protected $name = 'up';
|
||||
protected $description = 'Bring the application out of maintenance mode.';
|
||||
protected $usage = 'up';
|
||||
|
||||
public function run(array $params)
|
||||
{
|
||||
$filePath = WRITEPATH . 'down';
|
||||
|
||||
if (! file_exists($filePath)) {
|
||||
CLI::write('Application is not in maintenance mode.', 'yellow');
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (unlink($filePath)) {
|
||||
CLI::write('Application is now live.', 'green');
|
||||
} else {
|
||||
CLI::error('Failed to disable maintenance mode. Check file permissions.');
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="nl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Website in onderhoud</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
|
||||
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.container {
|
||||
text-align: center;
|
||||
padding: 2rem;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 4rem;
|
||||
margin-bottom: 1.5rem;
|
||||
animation: pulse 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0%, 100% { transform: scale(1); opacity: 1; }
|
||||
50% { transform: scale(1.1); opacity: 0.8; }
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2.5rem;
|
||||
font-weight: 600;
|
||||
margin-bottom: 1rem;
|
||||
color: #e94560;
|
||||
}
|
||||
|
||||
.message {
|
||||
font-size: 1.2rem;
|
||||
line-height: 1.8;
|
||||
color: #b8b8b8;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: 50px;
|
||||
font-size: 0.9rem;
|
||||
color: #4ecca3;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background: #4ecca3;
|
||||
border-radius: 50%;
|
||||
animation: blink 1.5s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.3; }
|
||||
}
|
||||
|
||||
.contact {
|
||||
margin-top: 2.5rem;
|
||||
font-size: 0.9rem;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.contact a {
|
||||
color: #e94560;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.contact a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="icon">🔧</div>
|
||||
<h1>Even geduld...</h1>
|
||||
<p class="message">
|
||||
We zijn bezig met onderhoudswerkzaamheden om DBOIS te verbeteren.
|
||||
We zijn zo snel mogelijk weer online.
|
||||
</p>
|
||||
<div class="status">
|
||||
<span class="status-dot"></span>
|
||||
Onderhoud in uitvoering!
|
||||
</div>
|
||||
<p class="contact">
|
||||
Vragen? Neem contact op via <a href="mailto:info@pensare.nl">info@pensare.nl</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user