0, 'failed' => 0]; for ($i = 0; $i < $rounds; $i++) { $result = VisitorLogWorker::processBatch($limit); $total['processed'] += $result['processed']; $total['failed'] += $result['failed']; if ($result['processed'] === 0) { break; } } if (PHP_SAPI === 'cli') { echo json_encode([ 'ok' => true, 'processed' => $total['processed'], 'failed' => $total['failed'], ], JSON_UNESCAPED_UNICODE) . "\n"; }