/** * Creates the remote api based on the module/plugin configuration using the extbase * reflection features. * * @param string $routeUrl * @param string $namespace * @return array */ public function createApi($routeUrl, $namespace) { $api = []; $api['url'] = $routeUrl; $api['type'] = 'remoting'; $api['namespace'] = $namespace; $api['actions'] = []; if (empty($this->frameworkConfiguration['controllerConfiguration'])) { # @todo improve me! Hack for fetching API of newsletter the hard way! # It looks $this->frameworkConfiguration['controllerConfiguration'] is empty as of TYPO3 6.1. Bug or feature? $this->frameworkConfiguration['controllerConfiguration'] = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['Newsletter']['modules']['web_NewsletterTxNewsletterM1']['controllers']; } foreach ($this->frameworkConfiguration['controllerConfiguration'] as $controllerName => $allowedControllerActions) { $unstrippedControllerName = $controllerName . 'Controller'; $controllerObjectName = 'Ecodev\\Newsletter\\Controller\\' . $unstrippedControllerName; $controllerActions = []; foreach ($allowedControllerActions['actions'] as $actionName) { $unstrippedActionName = $actionName . 'Action'; try { $actionParameters = $this->reflectionService->getMethodParameters($controllerObjectName, $unstrippedActionName); $controllerActions[] = ['len' => count($actionParameters), 'name' => $unstrippedActionName]; } catch (ReflectionException $re) { if ($unstrippedActionName !== 'extObjAction') { \Ecodev\Newsletter\Tools::getLogger(__CLASS__)->critical('You have a not existing action (' . $controllerObjectName . '::' . $unstrippedActionName . ') in your module/plugin configuration. This action will not be available for Ext.Direct remote execution.'); } } } $api['actions'][$unstrippedControllerName] = $controllerActions; } return $api; }
/** * Dispatch actions to take according to current bounce level */ public function dispatch() { $this->findEmail(); // If couldn't find the original email we cannot do anything if (!$this->email) { Tools::getLogger(__CLASS__)->warning('Bounced email found but cannot find corresponding record in database. Skipped.'); return; } $bounceLevel = $this->emailParser->getBounceLevel(); if ($bounceLevel != EmailParser::NEWSLETTER_NOT_A_BOUNCE) { if ($this->recipientList) { $this->recipientList->registerBounce($this->email->getRecipientAddress(), $bounceLevel); } $this->email->setBounceTime(new DateTime()); $emailRepository = $this->objectManager->get(\Ecodev\Newsletter\Domain\Repository\EmailRepository::class); $emailRepository->updateNow($this->email); } Tools::getLogger(__CLASS__)->info('Bounced email found with bounce level ' . $bounceLevel); }