Skip to content

Commit bc95d50

Browse files
committed
Merge branch 'release/28.0.0'
2 parents 43856cb + 3f28437 commit bc95d50

File tree

16 files changed

+235
-185
lines changed

16 files changed

+235
-185
lines changed

Classes/Command/QueueCommand.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
1717
use TYPO3\CMS\Core\Utility\GeneralUtility;
1818
use TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException;
19-
use TYPO3\CMS\Extbase\Object\Exception;
2019
use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException;
2120
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;
2221
use TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException;
23-
use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException;
24-
use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotReturnException;
2522

2623
class QueueCommand extends Command
2724
{
@@ -50,12 +47,9 @@ public function configure()
5047
* @throws IllegalObjectTypeException
5148
* @throws InvalidConfigurationTypeException
5249
* @throws InvalidQueryException
53-
* @throws InvalidSlotException
54-
* @throws InvalidSlotReturnException
5550
* @throws UnknownObjectException
5651
* @throws ArgumentMissingException
5752
* @throws MisconfigurationException
58-
* @throws Exception
5953
* @throws SiteNotFoundException
6054
*/
6155
protected function execute(InputInterface $input, OutputInterface $output): int

Classes/Domain/Repository/LinkRepository.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use In2code\Luxletter\Exception\ArgumentMissingException;
88
use In2code\Luxletter\Utility\DatabaseUtility;
99
use TYPO3\CMS\Core\Database\Connection;
10-
use TYPO3\CMS\Extbase\Object\Exception;
1110
use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException;
1211

1312
class LinkRepository extends AbstractRepository
@@ -47,7 +46,6 @@ public function isHashAlreadyExisting(string $hash): bool
4746
* @return void
4847
* @throws IllegalObjectTypeException
4948
* @throws ArgumentMissingException
50-
* @throws Exception
5149
*/
5250
public function add($object)
5351
{

Classes/Mail/MailMessage.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
declare(strict_types=1);
44
namespace In2code\Luxletter\Mail;
55

6+
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
67
use TYPO3\CMS\Core\Mail\MailMessage as MailMessageCore;
78
use TYPO3\CMS\Core\Utility\GeneralUtility;
89

@@ -16,11 +17,27 @@ private function initializeMailer()
1617
$this->mailer = GeneralUtility::makeInstance(Mailer::class);
1718
}
1819

20+
/**
21+
* @return bool
22+
* @throws TransportExceptionInterface
23+
*/
1924
public function send(): bool
2025
{
2126
$this->initializeMailer();
2227
$this->sent = false;
23-
$this->mailer->send($this);
28+
try {
29+
$this->mailer->send($this);
30+
} finally {
31+
// In case of SMTP always close the connection to the SMTP-server, especially in case of failure.
32+
// This prevents "421 Too many concurrent SMTP connections".
33+
if (method_exists($this->mailer->getTransport(), 'stop')) {
34+
// See Symfony\Component\Mailer\Transport\Smtp\SmtpTransport::stop()
35+
// https://github.com/symfony/mailer/blob/f466aa7c9ad74159986f91fda49a364b3bd9a2b6/Transport/Smtp/SmtpTransport.php#L295-L311
36+
// Compare to Symfony\Component\Mailer\Transport\Smtp\SmtpTransport::ping()
37+
// https://github.com/symfony/mailer/blob/f466aa7c9ad74159986f91fda49a364b3bd9a2b6/Transport/Smtp/SmtpTransport.php#L313-L324
38+
$this->mailer->getTransport()->stop();
39+
}
40+
}
2441
$sentMessage = $this->mailer->getSentMessage();
2542
if ($sentMessage) {
2643
$this->sent = true;

Classes/Mail/ProgressQueue.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,16 @@
1717
use Psr\EventDispatcher\EventDispatcherInterface;
1818
use Symfony\Component\Console\Helper\ProgressBar;
1919
use Symfony\Component\Console\Output\OutputInterface;
20+
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
2021
use Throwable;
2122
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
2223
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;
2324
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
2425
use TYPO3\CMS\Core\Utility\GeneralUtility;
2526
use TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException;
26-
use TYPO3\CMS\Extbase\Object\Exception;
2727
use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException;
2828
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;
2929
use TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException;
30-
use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException;
31-
use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotReturnException;
3230

3331
/**
3432
* Class ProgressQueue
@@ -78,14 +76,11 @@ public function __construct(OutputInterface $output)
7876
* @param int $newsletterIdentifier
7977
* @return int Number of progressed queued mails
8078
* @throws ArgumentMissingException
81-
* @throws Exception
8279
* @throws ExtensionConfigurationExtensionNotConfiguredException
8380
* @throws ExtensionConfigurationPathDoesNotExistException
8481
* @throws IllegalObjectTypeException
8582
* @throws InvalidConfigurationTypeException
8683
* @throws InvalidQueryException
87-
* @throws InvalidSlotException
88-
* @throws InvalidSlotReturnException
8984
* @throws MisconfigurationException
9085
* @throws SiteNotFoundException
9186
* @throws UnknownObjectException
@@ -122,15 +117,13 @@ public function progress(int $limit, int $newsletterIdentifier): int
122117
* @param Queue $queue
123118
* @return void
124119
* @throws ArgumentMissingException
125-
* @throws Exception
126120
* @throws ExtensionConfigurationExtensionNotConfiguredException
127121
* @throws ExtensionConfigurationPathDoesNotExistException
128122
* @throws IllegalObjectTypeException
129123
* @throws InvalidConfigurationTypeException
130-
* @throws InvalidSlotException
131-
* @throws InvalidSlotReturnException
132124
* @throws MisconfigurationException
133125
* @throws SiteNotFoundException
126+
* @throws TransportExceptionInterface
134127
*/
135128
protected function sendNewsletterToReceiverInQueue(Queue $queue): void
136129
{
@@ -170,13 +163,10 @@ protected function getSubject(Queue $queue): string
170163
* @param Queue $queue
171164
* @return string
172165
* @throws ArgumentMissingException
173-
* @throws Exception
174166
* @throws ExtensionConfigurationExtensionNotConfiguredException
175167
* @throws ExtensionConfigurationPathDoesNotExistException
176168
* @throws IllegalObjectTypeException
177169
* @throws InvalidConfigurationTypeException
178-
* @throws InvalidSlotException
179-
* @throws InvalidSlotReturnException
180170
* @throws MisconfigurationException
181171
* @throws SiteNotFoundException
182172
*/
@@ -204,12 +194,9 @@ protected function getBodyText(Queue $queue): string
204194
* @param string $bodytext
205195
* @return string
206196
* @throws ArgumentMissingException
207-
* @throws Exception
208197
* @throws ExtensionConfigurationExtensionNotConfiguredException
209198
* @throws ExtensionConfigurationPathDoesNotExistException
210199
* @throws IllegalObjectTypeException
211-
* @throws InvalidSlotException
212-
* @throws InvalidSlotReturnException
213200
* @throws MisconfigurationException
214201
* @throws SiteNotFoundException
215202
*/

Classes/Mail/SendMail.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use In2code\Luxletter\Exception\MisconfigurationException;
1414
use In2code\Luxletter\Utility\ConfigurationUtility;
1515
use Psr\EventDispatcher\EventDispatcherInterface;
16+
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
1617
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
1718
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;
1819
use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -52,6 +53,7 @@ public function __construct(
5253
* @throws ExtensionConfigurationExtensionNotConfiguredException
5354
* @throws ExtensionConfigurationPathDoesNotExistException
5455
* @throws MisconfigurationException
56+
* @throws TransportExceptionInterface
5557
*/
5658
public function sendNewsletter(array $receiver): bool
5759
{

Classes/Mail/TestMail.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use In2code\Luxletter\Exception\InvalidUrlException;
1414
use In2code\Luxletter\Exception\MisconfigurationException;
1515
use In2code\Luxletter\Utility\ConfigurationUtility;
16+
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
1617
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
1718
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;
1819
use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -69,6 +70,7 @@ public function __construct()
6970
* @throws InvalidUrlException
7071
* @throws MisconfigurationException
7172
* @throws ExceptionDbalDriver
73+
* @throws TransportExceptionInterface
7274
*/
7375
public function preflight(string $origin, string $layout, int $configuration, string $subject, string $email): bool
7476
{
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
namespace In2code\Luxletter\TCA;
5+
6+
use TYPO3\CMS\Core\DataHandling\Event\IsTableExcludedFromReferenceIndexEvent;
7+
8+
/**
9+
* Prevent reference index records for some Luxletter tables, to keep database small.
10+
*/
11+
class PreventReferenceIndex
12+
{
13+
protected array $excludedTables = [
14+
'tx_luxletter_domain_model_link',
15+
'tx_luxletter_domain_model_log',
16+
'tx_luxletter_domain_model_queue',
17+
];
18+
19+
public function __invoke(IsTableExcludedFromReferenceIndexEvent $event): void
20+
{
21+
if (in_array($event->getTable(), $this->excludedTables, true)) {
22+
$event->markAsExcluded();
23+
}
24+
}
25+
}

Classes/ViewHelpers/Format/CropBySelectionViewHelper.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use DomXPath;
99
use In2code\Luxletter\Utility\DomDocumentUtility;
1010
use In2code\Luxletter\Utility\ObjectUtility;
11-
use TYPO3\CMS\Extbase\Object\Exception;
1211
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
1312

1413
/**
@@ -40,7 +39,6 @@ public function initializeArguments(): void
4039

4140
/**
4241
* @return string
43-
* @throws Exception
4442
*/
4543
public function render(): string
4644
{
@@ -77,7 +75,6 @@ protected function getHtmlOfDomElement(DOMNode $element): string
7775
/**
7876
* @param string $string
7977
* @return string
80-
* @throws Exception
8178
*/
8279
protected function cropText(string $string): string
8380
{

Configuration/Services.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ services:
3232
- name: 'console.command'
3333
command: 'luxletter:queue'
3434

35+
In2code\Luxletter\TCA\PreventReferenceIndex:
36+
tags:
37+
- name: 'event.listener'
38+
identifier: 'luxletter/preventReferenceIndex'
39+
3540
In2code\Luxletter\Domain\Factory\NewsletterFactory:
3641
public: true
3742

0 commit comments

Comments
 (0)