setName(self::NAME) ->addOption( '--batch-limit', '-l', InputOption::VALUE_OPTIONAL, 'Number of hours to process per batch. 1 hour is default value.', '1' ) ->addOption( '--max-hours', null, InputOption::VALUE_OPTIONAL, 'Optionally specify how many hours back in time you wish to summarize.' ) ->addOption( '--rebuild', null, InputOption::VALUE_NONE, 'Rebuild existing data. To be used only if database exceptions have been known to cause inaccuracies.' ); parent::configure(); } /** * @throws \Doctrine\DBAL\Exception */ protected function execute(InputInterface $input, OutputInterface $output): int { if (!$this->checkRunStatus($input, $output)) { return \Symfony\Component\Console\Command\Command::SUCCESS; } $batchLimit = (int) $input->getOption('batch-limit'); $maxHours = (int) $input->getOption('max-hours'); $rebuild = (bool) $input->getOption('rebuild'); $output->writeln( "{$this->translator->trans('mautic.campaign.summarizing', ['%batch%' => $batchLimit])}" ); $this->summaryModel->summarize($output, $batchLimit, $maxHours, $rebuild); $this->completeRun(); return \Symfony\Component\Console\Command\Command::SUCCESS; } protected static $defaultDescription = 'Builds historical campaign summary statistics if they do not already exist.'; }