partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit ecc9a1bb13e7caf48e42015ba94f31f3e9696d7a
parent 35b1aac6be58af585ecddb1ec2fb8d8de3ddf490
Author: Felicitus <felicitus@felicitus.org>
Date:   Sat,  7 Nov 2015 21:16:02 +0100

Added run crons command

Diffstat:
Asrc/PartKeepr/CronLoggerBundle/Command/RunCronsCommand.php | 21+++++++++++++++++++++
Msrc/PartKeepr/CronLoggerBundle/Services/CronLoggerService.php | 4++++
2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/PartKeepr/CronLoggerBundle/Command/RunCronsCommand.php b/src/PartKeepr/CronLoggerBundle/Command/RunCronsCommand.php @@ -0,0 +1,21 @@ +<?php +namespace PartKeepr\CronLoggerBundle\Command; + +use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class RunCronsCommand extends ContainerAwareCommand +{ + public function configure() + { + parent::configure(); + $this->setName('partkeepr:cron:run'); + $this->setDescription("Runs all cron jobs"); + } + + public function execute(InputInterface $input, OutputInterface $output) + { + $this->getContainer()->get("partkeepr.cronlogger_service")->runCrons(); + } +} diff --git a/src/PartKeepr/CronLoggerBundle/Services/CronLoggerService.php b/src/PartKeepr/CronLoggerBundle/Services/CronLoggerService.php @@ -98,6 +98,10 @@ class CronLoggerService $query->execute(); } + /** + * Runs all crons + * @throws \Exception + */ public function runCrons () { $this->entityManager->beginTransaction(); $repository = $this->entityManager->getRepository("PartKeeprCronLoggerBundle:CronLogger");