![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/CampaignBundle/Executioner/Event/ |
<?php namespace Mautic\CampaignBundle\Executioner\Event; use Doctrine\Common\Collections\ArrayCollection; use Mautic\CampaignBundle\Entity\Event; use Mautic\CampaignBundle\Entity\LeadEventLog; use Mautic\CampaignBundle\EventCollector\Accessor\Event\AbstractEventAccessor; use Mautic\CampaignBundle\EventCollector\Accessor\Event\ActionAccessor; use Mautic\CampaignBundle\Executioner\Dispatcher\ActionDispatcher; use Mautic\CampaignBundle\Executioner\Exception\CannotProcessEventException; use Mautic\CampaignBundle\Executioner\Logger\EventLogger; use Mautic\CampaignBundle\Executioner\Result\EvaluatedContacts; class ActionExecutioner implements EventInterface { public const TYPE = 'action'; public function __construct( private ActionDispatcher $dispatcher, private EventLogger $eventLogger ) { } /** * @throws CannotProcessEventException * @throws \Mautic\CampaignBundle\Executioner\Dispatcher\Exception\LogNotProcessedException * @throws \Mautic\CampaignBundle\Executioner\Dispatcher\Exception\LogPassedAndFailedException */ public function execute(AbstractEventAccessor $config, ArrayCollection $logs): EvaluatedContacts { \assert($config instanceof ActionAccessor); /** @var LeadEventLog $firstLog */ if (!$firstLog = $logs->first()) { return new EvaluatedContacts(); } $event = $firstLog->getEvent(); if (Event::TYPE_ACTION !== $event->getEventType()) { throw new CannotProcessEventException('Cannot process event ID '.$event->getId().' as an action.'); } // Execute to process the batch of contacts $pendingEvent = $this->dispatcher->dispatchEvent($config, $event, $logs); $passed = $this->eventLogger->extractContactsFromLogs($pendingEvent->getSuccessful()); $failed = $this->eventLogger->extractContactsFromLogs($pendingEvent->getFailures()); return new EvaluatedContacts($passed, $failed); } }