$dbConfig */ $dbConfig = require $basePath . '/config/database.php'; /** @var array $appConfig */ $appConfig = require $basePath . '/config/app.php'; $limit = 20; foreach ($argv as $argument) { if (!str_starts_with((string) $argument, '--limit=')) { continue; } $limitValue = (int) substr((string) $argument, strlen('--limit=')); if ($limitValue > 0) { $limit = min(200, $limitValue); } } try { $pdo = ConnectionFactory::make($dbConfig); $cronJobs = new CronJobRepository($pdo); $processor = new CronJobProcessor($cronJobs); $integrationRepository = new IntegrationRepository( $pdo, (string) (($appConfig['integrations']['secret'] ?? '') ?: '') ); $offersRepository = new ChannelOffersRepository($pdo); $linksRepository = new ProductLinksRepository($pdo); $shopProClient = new ShopProClient(); $offerImportService = new OfferImportService($shopProClient, $offersRepository, $pdo); $linksHealthCheckHandler = new ProductLinksHealthCheckHandler( $integrationRepository, $offerImportService, $linksRepository, $offersRepository ); $processor->registerHandler(CronJobType::PRODUCT_LINKS_HEALTH_CHECK, $linksHealthCheckHandler); $result = $processor->run($limit); echo json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; } catch (\Throwable $exception) { fwrite(STDERR, '[error] ' . $exception->getMessage() . PHP_EOL); exit(1); }