setJSON([ 'status' => 'ok', 'time' => gmdate('c'), ]); } public function ready(): \CodeIgniter\HTTP\Response { $checks = [ 'database' => false, 'storage' => is_writable(\App\Libraries\Pipeline::storageDir()) || @mkdir(\App\Libraries\Pipeline::storageDir(), 0750, true), 'ffmpeg' => null, ]; try { db_connect()->query('SELECT 1'); $checks['database'] = true; } catch (\Throwable) { } $path = config('Site')->binaries['ffmpeg']; if ($path !== null && file_exists($path)) { $checks['ffmpeg'] = is_executable($path); } $ready = $checks['database'] && $checks['storage']; return response()->setStatusCode($ready ? 200 : 503)->setJSON([ 'status' => $ready ? 'ready' : 'not_ready', 'checks' => array_filter($checks, static fn ($v) => $v !== null), 'time' => gmdate('c'), ]); } }