@@ -9,8 +9,8 @@ |
||
| 9 | 9 | public function getKnownJobs() |
| 10 | 10 | { |
| 11 | 11 | $data = $this->getEntityManager() |
| 12 | - ->createQuery('SELECT job.command FROM CronBundle:CronJob job') |
|
| 13 | - ->getScalarResult(); |
|
| 12 | + ->createQuery('SELECT job.command FROM CronBundle:CronJob job') |
|
| 13 | + ->getScalarResult(); |
|
| 14 | 14 | $toRet = []; |
| 15 | 15 | foreach ($data as $datum) { |
| 16 | 16 | $toRet[] = $datum['command']; |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | protected function configure() |
| 13 | 13 | { |
| 14 | 14 | $this->setName('cron:enable-job') |
| 15 | - ->setDescription('Enables a cron job') |
|
| 16 | - ->addArgument('job', InputArgument::REQUIRED, 'Name of the job to enable'); |
|
| 15 | + ->setDescription('Enables a cron job') |
|
| 16 | + ->addArgument('job', InputArgument::REQUIRED, 'Name of the job to enable'); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -13,8 +13,8 @@ |
||
| 13 | 13 | protected function configure() |
| 14 | 14 | { |
| 15 | 15 | $this->setName('cron:pruneLogs') |
| 16 | - ->setDescription('Prunes the logs for each cron job, leaving only recent failures and the most recent success') |
|
| 17 | - ->addArgument('job', InputArgument::OPTIONAL, 'Operate only on this job'); |
|
| 16 | + ->setDescription('Prunes the logs for each cron job, leaving only recent failures and the most recent success') |
|
| 17 | + ->addArgument('job', InputArgument::OPTIONAL, 'Operate only on this job'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -13,8 +13,8 @@ |
||
| 13 | 13 | protected function configure() |
| 14 | 14 | { |
| 15 | 15 | $this->setName('cron:disable-job') |
| 16 | - ->setDescription('Disables a cron job') |
|
| 17 | - ->addArgument('job', InputArgument::REQUIRED, 'Name of the job to disable'); |
|
| 16 | + ->setDescription('Disables a cron job') |
|
| 17 | + ->addArgument('job', InputArgument::REQUIRED, 'Name of the job to disable'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -14,8 +14,8 @@ |
||
| 14 | 14 | protected function configure() |
| 15 | 15 | { |
| 16 | 16 | $this->setName('cron:status') |
| 17 | - ->setDescription('Displays the current status of cron jobs') |
|
| 18 | - ->addArgument('job', InputArgument::OPTIONAL, 'Show information for only this job'); |
|
| 17 | + ->setDescription('Displays the current status of cron jobs') |
|
| 18 | + ->addArgument('job', InputArgument::OPTIONAL, 'Show information for only this job'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -16,8 +16,8 @@ |
||
| 16 | 16 | protected function configure() |
| 17 | 17 | { |
| 18 | 18 | $this->setName('cron:run') |
| 19 | - ->setDescription('Runs any currently schedule cron jobs') |
|
| 20 | - ->addArgument('job', InputArgument::OPTIONAL, 'Run only this job (if enabled)'); |
|
| 19 | + ->setDescription('Runs any currently schedule cron jobs') |
|
| 20 | + ->addArgument('job', InputArgument::OPTIONAL, 'Run only this job (if enabled)'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $em->flush(); |
| 54 | 54 | |
| 55 | 55 | $end = microtime(true); |
| 56 | - $duration = sprintf('%0.2f', $end - $start); |
|
| 56 | + $duration = sprintf('%0.2f', $end-$start); |
|
| 57 | 57 | $output->writeln("Cron run completed in $duration seconds"); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | $statusStr = 'failed'; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $durationStr = sprintf('%0.2f', $jobEnd - $jobStart); |
|
| 103 | + $durationStr = sprintf('%0.2f', $jobEnd-$jobStart); |
|
| 104 | 104 | $output->writeln("$statusStr in $durationStr seconds"); |
| 105 | 105 | |
| 106 | 106 | // Record the result |
| 107 | - $this->recordJobResult($em, $job, $jobEnd - $jobStart, $jobOutput->getOutput(), $returnCode); |
|
| 107 | + $this->recordJobResult($em, $job, $jobEnd-$jobStart, $jobOutput->getOutput(), $returnCode); |
|
| 108 | 108 | |
| 109 | 109 | // And update the job with it's next scheduled time |
| 110 | 110 | $newTime = new \DateTime(); |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | protected function configure() |
| 17 | 17 | { |
| 18 | 18 | $this->setName('cron:scan') |
| 19 | - ->setDescription('Scans for any new or deleted cron jobs') |
|
| 20 | - ->addOption('keep-deleted', 'k', InputOption::VALUE_NONE, 'If set, deleted cron jobs will not be removed') |
|
| 21 | - ->addOption('default-disabled', 'd', InputOption::VALUE_NONE, 'If set, new jobs will be disabled by default'); |
|
| 19 | + ->setDescription('Scans for any new or deleted cron jobs') |
|
| 20 | + ->addOption('keep-deleted', 'k', InputOption::VALUE_NONE, 'If set, deleted cron jobs will not be removed') |
|
| 21 | + ->addOption('default-disabled', 'd', InputOption::VALUE_NONE, 'If set, new jobs will be disabled by default'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | protected function execute(InputInterface $input, OutputInterface $output) |