setName('mautic:reports:scheduler')
->addOption('--report', 'report', InputOption::VALUE_OPTIONAL, 'ID of report. Process all reports if not set.');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$report = $input->getOption('report');
try {
$exportOption = new ExportOption($report);
} catch (\InvalidArgumentException $e) {
$output->writeln(''.$this->translator->trans('mautic.report.schedule.command.invalid_parameter').'');
return Command::SUCCESS;
}
try {
if ($exportOption->getReportId()) {
$this->reportCleanup->cleanup($exportOption->getReportId());
} else {
$this->reportCleanup->cleanupAll();
}
$this->reportExporter->processExport($exportOption);
$output->writeln(''.$this->translator->trans('mautic.report.schedule.command.finished').'');
} catch (FileIOException $e) {
$output->writeln(''.$e->getMessage().'');
}
return Command::SUCCESS;
}
protected static $defaultDescription = 'Processes scheduler for report\'s export';
}