From 22157d5c26ea132be3bad6eaccc1da292d76168c Mon Sep 17 00:00:00 2001 From: erk Date: Tue, 11 Apr 2023 16:39:44 +0200 Subject: [PATCH 1/2] Add exit code to some mautic commands for mautic 5 --- app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php | 4 +++- .../CampaignBundle/Command/UpdateLeadCampaignsCommand.php | 2 +- .../WebhookBundle/Command/ProcessWebhookQueuesCommand.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php b/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php index ad47f4cd3dd..9eceb4270e2 100644 --- a/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php +++ b/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php @@ -217,16 +217,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Specific campaign; if ($id) { + $statusCode = 0; /** @var \Mautic\CampaignBundle\Entity\Campaign $campaign */ if ($campaign = $this->campaignRepository->getEntity($id)) { $this->triggerCampaign($campaign); } else { $output->writeln(''.$this->translator->trans('mautic.campaign.rebuild.not_found', ['%id%' => $id]).''); + $statusCode = 1; } $this->completeRun(); - return 0; + return $statusCode; } // All published campaigns diff --git a/app/bundles/CampaignBundle/Command/UpdateLeadCampaignsCommand.php b/app/bundles/CampaignBundle/Command/UpdateLeadCampaignsCommand.php index de59e69923d..6e523983be2 100644 --- a/app/bundles/CampaignBundle/Command/UpdateLeadCampaignsCommand.php +++ b/app/bundles/CampaignBundle/Command/UpdateLeadCampaignsCommand.php @@ -139,7 +139,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (null === $campaign) { $output->writeln(''.$this->translator->trans('mautic.campaign.rebuild.not_found', ['%id%' => $id]).''); - return 0; + return 1; } $this->updateCampaign($campaign); diff --git a/app/bundles/WebhookBundle/Command/ProcessWebhookQueuesCommand.php b/app/bundles/WebhookBundle/Command/ProcessWebhookQueuesCommand.php index 6d29f1d58a0..ae655b9f197 100644 --- a/app/bundles/WebhookBundle/Command/ProcessWebhookQueuesCommand.php +++ b/app/bundles/WebhookBundle/Command/ProcessWebhookQueuesCommand.php @@ -73,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!count($webhooks)) { $output->writeln('No published webhooks found. Try again later.'); - return 0; + return 1; } $output->writeLn('Processing Webhooks'); From eb327e600be97dfd9d30eeed56016f6f224694ea Mon Sep 17 00:00:00 2001 From: erk Date: Wed, 12 Apr 2023 14:24:14 +0000 Subject: [PATCH 2/2] Add suggestion from Rector (fix email author name) --- app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php b/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php index 9eceb4270e2..8553dd1b6da 100644 --- a/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php +++ b/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php @@ -228,7 +228,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->completeRun(); - return $statusCode; + return (int) $statusCode; } // All published campaigns