Skip to content

Commit

Permalink
[ENG-619] Corrections to queries and addition of caching.
Browse files Browse the repository at this point in the history
  • Loading branch information
heathdutton committed Feb 19, 2019
1 parent bc57e7a commit 69b1f7c
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 111 deletions.
39 changes: 20 additions & 19 deletions Command/HealthCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use MauticPlugin\MauticHealthBundle\Model\HealthModel;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;

/**
Expand Down Expand Up @@ -67,7 +68,6 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$verbose = $input->getOption('verbose');
// $campaignRebuildDelay = $input->getOption('campaign-rebuild-delay');
$campaignKickoffDelay = $input->getOption('campaign-kickoff-delay');
$campaignScheduledDelay = $input->getOption('campaign-scheduled-delay');
Expand All @@ -76,15 +76,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
$container = $this->getContainer();
$translator = $container->get('translator');

if ($quiet) {
$output = new NullOutput();
}
if (!$this->checkRunStatus($input, $output)) {
return 0;
}

/** @var HealthModel $healthModel */
$healthModel = $container->get('mautic.health.model.health');
if ($verbose) {
$output->writeln('<info>'.$translator->trans('mautic.health.running').'</info>');
}
$output->writeln('<info>'.$translator->trans('mautic.health.running').'</info>');
$settings = [];
// if ($campaignRebuildDelay) {
// $settings['campaign_rebuild_delay'] = $campaignRebuildDelay;
Expand All @@ -101,26 +102,26 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($settings) {
$healthModel->setSettings($settings);
}
if ($verbose) {
$output->writeln('<info>'.$translator->trans('mautic.health.kickoff').'</info>');
}
$healthModel->campaignKickoffCheck($output, $verbose);
if ($verbose) {
$output->writeln('<info>'.$translator->trans('mautic.health.scheduled').'</info>');
}
$healthModel->campaignScheduledCheck($output, $verbose);

$output->writeln('<info>'.$translator->trans('mautic.health.kickoff').'</info>');
$healthModel->campaignKickoffCheck($output);

$output->writeln('<info>'.$translator->trans('mautic.health.scheduled').'</info>');
$healthModel->campaignScheduledCheck($output);

// @todo - Add negative action path check.
// $healthModel->campaignRebuildCheck($output, $verbose);
$healthModel->setCache();

$test = $healthModel->getCache();
if (!$quiet) {
$healthModel->reportIncidents($output);
}
if ($verbose) {
$output->writeln(
'<info>'.$translator->trans(
'mautic.health.complete'
).'</info>'
);
}
$output->writeln(
'<info>'.$translator->trans(
'mautic.health.complete'
).'</info>'
);
$this->completeRun();

return 0;
Expand Down
Loading

0 comments on commit 69b1f7c

Please sign in to comment.