diff --git a/src/Command/CleanupCommand.php b/src/Command/CleanupCommand.php index dd98953..a79f321 100644 --- a/src/Command/CleanupCommand.php +++ b/src/Command/CleanupCommand.php @@ -18,7 +18,6 @@ use Symfony\Component\HttpKernel\KernelInterface; #[AsCommand(name: 'webcron:cleanup', description: 'Cleanup runs')] class CleanupCommand extends Command { - protected static $defaultName = 'webcron:cleanup'; protected $kernel; protected $doctrine; @@ -36,19 +35,13 @@ class CleanupCommand extends Command ->addOption('maxage', 'm', InputOption::VALUE_REQUIRED, 'The maximum age of the oldest runs'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output) : int { $maxage = $input->getOption('maxage'); $jobs = $input->getOption('jobid'); $runRepo = $this->doctrine->getRepository(Run::class); - try { - $deleted = $runRepo->cleanupRuns($jobs, $maxage); - $output->writeln('Deleted ' . $deleted . ' runs'); - return Command::SUCCESS; - } catch(Exception $exception) { - $output->writeln($exception->getMessage()); - return Command::FAILURE; - } + $deleted = $runRepo->cleanupRuns($jobs, $maxage); + $output->writeln('Deleted ' . $deleted . ' runs'); return Command::SUCCESS; } } \ No newline at end of file diff --git a/src/Command/DaemonCommand.php b/src/Command/DaemonCommand.php index d36a161..2b4ed73 100644 --- a/src/Command/DaemonCommand.php +++ b/src/Command/DaemonCommand.php @@ -35,7 +35,7 @@ class DaemonCommand extends Command ->addOption('async', 'a', InputOption::VALUE_NEGATABLE, 'Time limit in seconds before stopping the daemon.'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output) : int { $jobRepo = $this->doctrine->getRepository(Job::class); $timelimit = $input->getOption('time-limit') ?? false; diff --git a/src/Command/DemoInstallCommand.php b/src/Command/DemoInstallCommand.php index a0e1e99..8716262 100755 --- a/src/Command/DemoInstallCommand.php +++ b/src/Command/DemoInstallCommand.php @@ -37,7 +37,7 @@ class DemoInstallCommand extends Command ->setHelp('This command installs the demo data'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output) : int { $em = $this->doctrine->getManager(); diff --git a/src/Command/MailFailedRunsCommand.php b/src/Command/MailFailedRunsCommand.php index e9210c9..3c686c0 100644 --- a/src/Command/MailFailedRunsCommand.php +++ b/src/Command/MailFailedRunsCommand.php @@ -49,7 +49,7 @@ class MailFailedRunsCommand extends Command * @throws \Twig\Error\SyntaxError * @throws \Twig\Error\LoaderError */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output) : int { $jobRepo = $this->doctrine->getRepository(Job::class); diff --git a/src/Command/RunCommand.php b/src/Command/RunCommand.php index e124aa7..6e2dc5c 100755 --- a/src/Command/RunCommand.php +++ b/src/Command/RunCommand.php @@ -31,7 +31,7 @@ class RunCommand extends Command ->addArgument('jobid', InputArgument::REQUIRED, 'The id of the job to be run'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output) : int { $jobRepo = $this->doctrine->getRepository(Job::class); $jobId = (int)$input->getArgument('jobid'); diff --git a/src/Command/UserCommand.php b/src/Command/UserCommand.php index 6123a44..67441ec 100755 --- a/src/Command/UserCommand.php +++ b/src/Command/UserCommand.php @@ -56,7 +56,7 @@ class UserCommand extends Command ->addOption('password', 'p', InputOption::VALUE_OPTIONAL, 'What action should be executed? [add, delete, update]', ''); } - protected function initialize(InputInterface $input, OutputInterface $output) + protected function initialize(InputInterface $input, OutputInterface $output) : void { $this->action = $input->getArgument('action'); $this->username = $input->getOption('username'); @@ -64,7 +64,7 @@ class UserCommand extends Command $this->io = new SymfonyStyle($input, $output); } - protected function interact(InputInterface $input, OutputInterface $output) + protected function interact(InputInterface $input, OutputInterface $output) : void { if(!empty($this->password)) { $this->io->warning('It is not safe to send password directly via STDIN'); @@ -117,7 +117,7 @@ class UserCommand extends Command } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output) : int { switch ($this->action) { case 'add':