Files

34 lines
810 B
PHP

<?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;
}
}