commit e37377089feab9f4249ae9a248b7d951b316fd36
parent 3f0af94af48f47731a815148b10e6a17e39bb0c9
Author: Felicitus <felicitus@felicitus.org>
Date: Sat, 7 Nov 2015 20:56:34 +0100
Clear cron logger table on setup and initially run all cronjobs
Diffstat:
3 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/src/PartKeepr/CoreBundle/Command/ClearCronLoggerCommand.php b/src/PartKeepr/CoreBundle/Command/ClearCronLoggerCommand.php
@@ -0,0 +1,22 @@
+<?php
+namespace PartKeepr\CoreBundle\Command;
+
+use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+
+class ClearCronLoggerCommand extends ContainerAwareCommand
+{
+ public function configure()
+ {
+ parent::configure();
+ $this->setName('partkeepr:cron:clear');
+ $this->setDescription("Clears all cron logger entries");
+ }
+
+ public function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->getContainer()->get("partkeepr.cronlogger_service")->clear();
+ }
+}
diff --git a/src/PartKeepr/CronLoggerBundle/Services/CronLoggerService.php b/src/PartKeepr/CronLoggerBundle/Services/CronLoggerService.php
@@ -77,4 +77,14 @@ class CronLoggerService
return $failedCronjobs;
}
+
+ /**
+ * Clears all cron logger entries
+ */
+ public function clear () {
+ $dql = "DELETE FROM PartKeepr\CronLoggerBundle\Entity\CronLogger c";
+ $query = $this->entityManager->createQuery($dql);
+
+ $query->execute();
+ }
}
diff --git a/src/PartKeepr/SetupBundle/Controller/CacheWarmupSetupController.php b/src/PartKeepr/SetupBundle/Controller/CacheWarmupSetupController.php
@@ -64,6 +64,30 @@ class CacheWarmupSetupController extends SetupController
$application->run($input, $output);
+ $input = new ArrayInput(array(
+ 'command' => 'partkeepr:cron:clear',
+ ));
+
+ $application->run($input, $output);
+
+ $input = new ArrayInput(array(
+ 'command' => 'partkeepr:cron:versioncheck',
+ ));
+
+ $application->run($input, $output);
+
+ $input = new ArrayInput(array(
+ 'command' => 'partkeepr:cron:synctips',
+ ));
+
+ $application->run($input, $output);
+
+ $input = new ArrayInput(array(
+ 'command' => 'partkeepr:cron:create-statistic-snapshot',
+ ));
+
+ $application->run($input, $output);
+
} catch (\Exception $e) {
$response["success"] = false;
$response["message"] = "Cache warm up error";