$name, 'id' => $articleId, 'enabled' => is_file($dir . '/.movmaker-enabled'), 'preview' => is_file($dir . '/.movmaker-preview'), ]; $locked = is_dir($lockDir); if ($locked || $status === 'processing') { $started = ''; if (is_file($lockDir . '/started_at')) $started = trim((string)file_get_contents($lockDir . '/started_at')); if ($started === '' && is_array($state)) $started = (string)($state['started_at'] ?? $state['updated_at'] ?? ''); $jobs[] = [ 'name' => $name, 'id' => $articleId, 'status' => $status ?: ($locked ? 'processing' : 'unknown'), 'started_at' => $started, ]; } } echo json_encode(['jobs' => $jobs, 'switches' => $switches, 'checked_at' => date('c')], JSON_UNESCAPED_UNICODE);