<?php
// =============================================================================
// cron/sports_sync.php — CLI cron entry point for the sports feed sync.
//
// Schedule in cPanel → Cron Jobs:
//     php /home/<user>/public_html/<panel_subdir>/cron/sports_sync.php
//
// Suggested cadence: every 30 minutes.
// =============================================================================

if (PHP_SAPI !== 'cli') {
    header('Content-Type: text/plain; charset=utf-8', true, 403);
    echo "cron entry point — only callable from the command line";
    exit;
}

require_once __DIR__ . '/../includes/bootstrap.php';
require_once __DIR__ . '/../includes/sports/sync.php';

$r = sports_sync_once();
echo json_encode($r, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), PHP_EOL;
exit($r['ok'] ? 0 : 1);
