@@ -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) |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $entityManager->flush(); |
52 | 52 | |
53 | 53 | $end = microtime(true); |
54 | - $duration = sprintf('%0.2f', $end - $start); |
|
54 | + $duration = sprintf('%0.2f', $end-$start); |
|
55 | 55 | $output->writeln("Cron run completed in $duration seconds"); |
56 | 56 | } |
57 | 57 | |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | $statusStr = 'failed'; |
100 | 100 | } |
101 | 101 | |
102 | - $durationStr = sprintf('%0.2f', $jobEnd - $jobStart); |
|
102 | + $durationStr = sprintf('%0.2f', $jobEnd-$jobStart); |
|
103 | 103 | $output->writeln("$statusStr in $durationStr seconds"); |
104 | 104 | |
105 | 105 | // Record the result |
106 | - $this->recordJobResult($job, $jobEnd - $jobStart, $jobOutput->getOutput(), $returnCode); |
|
106 | + $this->recordJobResult($job, $jobEnd-$jobStart, $jobOutput->getOutput(), $returnCode); |
|
107 | 107 | |
108 | 108 | // And update the job with it's next scheduled time |
109 | 109 | $interval = new \DateInterval($job->getInterval()); |
@@ -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) |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | /** |
166 | 166 | * Add results. |
167 | 167 | * |
168 | - * @param Alpixel\Bundle\CronBundle\Entity\CronJobResult $results |
|
168 | + * @param CronJobResult $results |
|
169 | 169 | */ |
170 | 170 | public function addCronJobResult(\Alpixel\Bundle\CronBundle\Entity\CronJobResult $results) |
171 | 171 | { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | /** |
186 | 186 | * Set mostRecentRun. |
187 | 187 | * |
188 | - * @param Alpixel\Bundle\CronBundle\Entity\CronJobResult $mostRecentRun |
|
188 | + * @param CronJobResult $mostRecentRun |
|
189 | 189 | */ |
190 | 190 | public function setMostRecentRun(\Alpixel\Bundle\CronBundle\Entity\CronJobResult $mostRecentRun) |
191 | 191 | { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | /** |
196 | 196 | * Get mostRecentRun. |
197 | 197 | * |
198 | - * @return Alpixel\Bundle\CronBundle\Entity\CronJobResult |
|
198 | + * @return CronJobResult |
|
199 | 199 | */ |
200 | 200 | public function getMostRecentRun() |
201 | 201 | { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | /** |
158 | 158 | * Set job. |
159 | 159 | * |
160 | - * @param Alpixel\Bundle\CronBundle\Entity\CronJob $job |
|
160 | + * @param CronJob $job |
|
161 | 161 | */ |
162 | 162 | public function setJob(\Alpixel\Bundle\CronBundle\Entity\CronJob $job) |
163 | 163 | { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * Get job. |
169 | 169 | * |
170 | - * @return Alpixel\Bundle\CronBundle\Entity\CronJob |
|
170 | + * @return CronJob |
|
171 | 171 | */ |
172 | 172 | public function getJob() |
173 | 173 | { |