Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config/PHPMD/rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
<rule ref="rulesets/design.xml/GotoStatement"/>
<rule ref="rulesets/design.xml/NumberOfChildren"/>
<rule ref="rulesets/design.xml/DepthOfInheritance"/>
<rule ref="rulesets/design.xml/CouplingBetweenObjects"/>
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
<properties>
<property name="maximum" value="15"/>
</properties>
</rule>
<rule ref="rulesets/design.xml/DevelopmentCodeFragment"/>

<!-- rules from the "naming" rule set -->
Expand Down
6 changes: 0 additions & 6 deletions config/doctrine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ doctrine:
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: false
mappings:
TatevikGrRssBundle:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/vendor/tatevikgr/rss-feed/src/Entity'
prefix: 'TatevikGr\RssFeedBundle\Entity'
alias: 'RssBundle'
Identity:
is_bundle: false
type: attribute
Expand Down
6 changes: 6 additions & 0 deletions config/packages/messenger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ framework:

transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
sync: 'sync://'
async_email:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
options:
Expand All @@ -25,3 +26,8 @@ framework:
# Route your messages to the transports
'PhpList\Core\Domain\Messaging\Message\AsyncEmailMessage': async_email
'PhpList\Core\Domain\Messaging\Message\SubscriberConfirmationMessage': async_email
'PhpList\Core\Domain\Messaging\Message\SubscriptionConfirmationMessage': async_email
'PhpList\Core\Domain\Messaging\Message\PasswordResetMessage': async_email
'PhpList\Core\Domain\Messaging\Message\CampaignProcessorMessage': async_email
'PhpList\Core\Domain\Messaging\Message\SyncCampaignProcessorMessage': sync

2 changes: 1 addition & 1 deletion config/services/commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
resource: '../../src/Domain/Identity/Command'
tags: ['console.command']

PhpList\Core\Domain\Messaging\Command\ProcessBouncesCommand:
PhpList\Core\Bounce\Command\ProcessBouncesCommand:
arguments:
$protocolProcessors: !tagged_iterator 'phplist.bounce_protocol_processor'

Expand Down
2 changes: 1 addition & 1 deletion config/services/managers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ services:
autowire: true
autoconfigure: true

PhpList\Core\Domain\Messaging\Service\Manager\BounceManager:
PhpList\Core\Bounce\Service\Manager\BounceManager:
autowire: true
autoconfigure: true

Expand Down
7 changes: 4 additions & 3 deletions config/services/messenger.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
services:
# Register message handlers for Symfony Messenger
PhpList\Core\Domain\Messaging\MessageHandler\:
autowire: true
resource: '../../src/Domain/Messaging/MessageHandler'
tags: [ 'messenger.message_handler' ]

Expand All @@ -24,7 +25,7 @@ services:
$passwordResetUrl: '%app.password_reset_url%'

PhpList\Core\Domain\Messaging\MessageHandler\SubscriptionConfirmationMessageHandler:
autowire: true
autoconfigure: true
tags: [ 'messenger.message_handler' ]
autowire: true
autoconfigure: true
tags: [ 'messenger.message_handler' ]

10 changes: 5 additions & 5 deletions config/services/processor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ services:
autoconfigure: true
public: false

PhpList\Core\Domain\Messaging\Service\Processor\PopBounceProcessor:
PhpList\Core\Bounce\Service\Processor\PopBounceProcessor:
arguments:
$host: '%imap_bounce.host%'
$port: '%imap_bounce.port%'
$mailboxNames: '%imap_bounce.mailbox_name%'
tags: ['phplist.bounce_protocol_processor']

PhpList\Core\Domain\Messaging\Service\Processor\MboxBounceProcessor:
PhpList\Core\Bounce\Service\Processor\MboxBounceProcessor:
tags: ['phplist.bounce_protocol_processor']

PhpList\Core\Domain\Messaging\Service\Processor\AdvancedBounceRulesProcessor: ~
PhpList\Core\Bounce\Service\Processor\AdvancedBounceRulesProcessor: ~

PhpList\Core\Domain\Messaging\Service\Processor\UnidentifiedBounceReprocessor: ~
PhpList\Core\Bounce\Service\Processor\UnidentifiedBounceReprocessor: ~

PhpList\Core\Domain\Messaging\Service\Processor\BounceDataProcessor: ~
PhpList\Core\Bounce\Service\Processor\BounceDataProcessor: ~
2 changes: 1 addition & 1 deletion config/services/resolvers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ services:
autowire: true
autoconfigure: true

PhpList\Core\Domain\Messaging\Service\BounceActionResolver:
PhpList\Core\Bounce\Service\BounceActionResolver:
arguments:
- !tagged_iterator { tag: 'phplist.bounce_action_handler' }
21 changes: 8 additions & 13 deletions config/services/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ services:
autoconfigure: true
public: true

PhpList\Core\Domain\Messaging\Service\Processor\CampaignProcessor:
autowire: true
autoconfigure: true
public: true

PhpList\Core\Domain\Messaging\Service\SendRateLimiter:
autowire: true
autoconfigure: true
Expand All @@ -52,7 +47,7 @@ services:
autowire: true
autoconfigure: true

PhpList\Core\Domain\Messaging\Service\ConsecutiveBounceHandler:
PhpList\Core\Bounce\Service\ConsecutiveBounceHandler:
autowire: true
autoconfigure: true
arguments:
Expand All @@ -61,7 +56,7 @@ services:

Webklex\PHPIMAP\ClientManager: ~

PhpList\Core\Domain\Messaging\Service\WebklexImapClientFactory:
PhpList\Core\Bounce\Service\WebklexImapClientFactory:
autowire: true
autoconfigure: true
arguments:
Expand All @@ -78,34 +73,34 @@ services:
$username: '%imap_bounce.email%'
$password: '%imap_bounce.password%'

PhpList\Core\Domain\Messaging\Service\NativeBounceProcessingService:
PhpList\Core\Bounce\Service\NativeBounceProcessingService:
autowire: true
autoconfigure: true
arguments:
$purgeProcessed: '%imap_bounce.purge%'
$purgeUnprocessed: '%imap_bounce.purge_unprocessed%'

PhpList\Core\Domain\Messaging\Service\WebklexBounceProcessingService:
PhpList\Core\Bounce\Service\WebklexBounceProcessingService:
autowire: true
autoconfigure: true
arguments:
$purgeProcessed: '%imap_bounce.purge%'
$purgeUnprocessed: '%imap_bounce.purge_unprocessed%'

PhpList\Core\Domain\Messaging\Service\LockService:
PhpList\Core\Bounce\Service\LockService:
autowire: true
autoconfigure: true

PhpList\Core\Domain\Subscription\Service\SubscriberBlacklistService:
PhpList\Core\Bounce\Service\SubscriberBlacklistService:
autowire: true
autoconfigure: true

PhpList\Core\Domain\Messaging\Service\MessageParser:
PhpList\Core\Bounce\Service\MessageParser:
autowire: true
autoconfigure: true

_instanceof:
PhpList\Core\Domain\Messaging\Service\Handler\BounceActionHandlerInterface:
PhpList\Core\Bounce\Service\Handler\BounceActionHandlerInterface:
tags:
- { name: 'phplist.bounce_action_handler' }

Expand Down
4 changes: 4 additions & 0 deletions resources/translations/messages.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,10 @@ Thank you.</target>
<source>No data changed</source>
<target>__No data changed</target>
</trans-unit>
<trans-unit id="n7nf5lh" resname="Campaign not found or not in submitted status">
<source>Campaign not found or not in submitted status</source>
<target>__Campaign not found or not in submitted status</target>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Command;
namespace PhpList\Core\Bounce\Command;

use Doctrine\ORM\EntityManagerInterface;
use Exception;
use PhpList\Core\Domain\Messaging\Service\ConsecutiveBounceHandler;
use PhpList\Core\Domain\Messaging\Service\Processor\BounceProtocolProcessor;
use PhpList\Core\Domain\Messaging\Service\Processor\AdvancedBounceRulesProcessor;
use PhpList\Core\Domain\Messaging\Service\Processor\UnidentifiedBounceReprocessor;
use PhpList\Core\Domain\Messaging\Service\LockService;
use PhpList\Core\Bounce\Service\ConsecutiveBounceHandler;
use PhpList\Core\Bounce\Service\LockService;
use PhpList\Core\Bounce\Service\Processor\AdvancedBounceRulesProcessor;
use PhpList\Core\Bounce\Service\Processor\BounceProtocolProcessor;
use PhpList\Core\Bounce\Service\Processor\UnidentifiedBounceReprocessor;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
Expand Down Expand Up @@ -46,6 +47,7 @@ public function __construct(
private readonly UnidentifiedBounceReprocessor $unidentifiedReprocessor,
private readonly ConsecutiveBounceHandler $consecutiveBounceHandler,
private readonly TranslatorInterface $translator,
private readonly EntityManagerInterface $entityManager,
) {
parent::__construct();
}
Expand All @@ -62,6 +64,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$force = (bool)$input->getOption('force');
$lock = $this->lockService->acquirePageLock('bounce_processor', $force);
$this->entityManager->flush();

if (($lock ?? 0) === 0) {
$forceLockFailed = $this->translator->trans('Could not apply force lock. Aborting.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Exception;
namespace PhpList\Core\Bounce\Exception;

use RuntimeException;
use Throwable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Exception;
namespace PhpList\Core\Bounce\Exception;

use RuntimeException;
use Throwable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Service;
namespace PhpList\Core\Bounce\Service;

use PhpList\Core\Domain\Messaging\Service\Handler\BounceActionHandlerInterface;
use PhpList\Core\Bounce\Service\Handler\BounceActionHandlerInterface;
use RuntimeException;

class BounceActionResolver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Service;
namespace PhpList\Core\Bounce\Service;

interface BounceProcessingServiceInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Service;
namespace PhpList\Core\Bounce\Service;

use PhpList\Core\Bounce\Service\Manager\BounceManager;
use PhpList\Core\Domain\Messaging\Model\Bounce;
use PhpList\Core\Domain\Messaging\Model\UserMessage;
use PhpList\Core\Domain\Messaging\Model\UserMessageBounce;
use PhpList\Core\Domain\Messaging\Service\Manager\BounceManager;
use PhpList\Core\Domain\Subscription\Model\Subscriber;
use PhpList\Core\Domain\Subscription\Repository\SubscriberRepository;
use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberHistoryManager;
use PhpList\Core\Domain\Subscription\Service\SubscriberBlacklistService;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Contracts\Translation\TranslatorInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Service\Handler;
namespace PhpList\Core\Bounce\Service\Handler;

use PhpList\Core\Domain\Messaging\Service\Manager\BounceManager;
use PhpList\Core\Bounce\Service\Manager\BounceManager;
use PhpList\Core\Bounce\Service\SubscriberBlacklistService;
use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberHistoryManager;
use PhpList\Core\Domain\Subscription\Service\SubscriberBlacklistService;
use Symfony\Contracts\Translation\TranslatorInterface;

class BlacklistEmailAndDeleteBounceHandler implements BounceActionHandlerInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Service\Handler;
namespace PhpList\Core\Bounce\Service\Handler;

use PhpList\Core\Bounce\Service\SubscriberBlacklistService;
use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberHistoryManager;
use PhpList\Core\Domain\Subscription\Service\SubscriberBlacklistService;
use Symfony\Contracts\Translation\TranslatorInterface;

class BlacklistEmailHandler implements BounceActionHandlerInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Service\Handler;
namespace PhpList\Core\Bounce\Service\Handler;

use PhpList\Core\Domain\Messaging\Service\Manager\BounceManager;
use PhpList\Core\Bounce\Service\Manager\BounceManager;
use PhpList\Core\Bounce\Service\SubscriberBlacklistService;
use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberHistoryManager;
use PhpList\Core\Domain\Subscription\Service\SubscriberBlacklistService;
use Symfony\Contracts\Translation\TranslatorInterface;

class BlacklistUserAndDeleteBounceHandler implements BounceActionHandlerInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Service\Handler;
namespace PhpList\Core\Bounce\Service\Handler;

use PhpList\Core\Bounce\Service\SubscriberBlacklistService;
use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberHistoryManager;
use PhpList\Core\Domain\Subscription\Service\SubscriberBlacklistService;
use Symfony\Contracts\Translation\TranslatorInterface;

class BlacklistUserHandler implements BounceActionHandlerInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Service\Handler;
namespace PhpList\Core\Bounce\Service\Handler;

interface BounceActionHandlerInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,27 @@

declare(strict_types=1);

namespace PhpList\Core\Domain\Messaging\Service\Handler;
namespace PhpList\Core\Bounce\Service\Handler;

use PhpList\Core\Domain\Messaging\Service\Manager\BounceManager;
use PhpList\Core\Bounce\Service\Manager\BounceManager;
use PhpList\Core\Domain\Subscription\Repository\SubscriberRepository;
use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberHistoryManager;
use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberManager;
use Symfony\Contracts\Translation\TranslatorInterface;

class DecreaseCountConfirmUserAndDeleteBounceHandler implements BounceActionHandlerInterface
{
private SubscriberHistoryManager $subscriberHistoryManager;
private SubscriberManager $subscriberManager;
private BounceManager $bounceManager;
private SubscriberRepository $subscriberRepository;
private TranslatorInterface $translator;

public function __construct(
SubscriberHistoryManager $subscriberHistoryManager,
SubscriberManager $subscriberManager,
BounceManager $bounceManager,
SubscriberRepository $subscriberRepository,
TranslatorInterface $translator,
) {
$this->subscriberHistoryManager = $subscriberHistoryManager;
$this->subscriberManager = $subscriberManager;
$this->bounceManager = $bounceManager;
$this->subscriberRepository = $subscriberRepository;
$this->translator = $translator;
Expand All @@ -40,7 +36,7 @@ public function supports(string $action): bool
public function handle(array $closureData): void
{
if (!empty($closureData['subscriber'])) {
$this->subscriberManager->decrementBounceCount($closureData['subscriber']);
$this->subscriberRepository->decrementBounceCount($closureData['subscriber']);
if (!$closureData['confirmed']) {
$this->subscriberRepository->markConfirmed($closureData['userId']);
$this->subscriberHistoryManager->addHistory(
Expand Down
Loading
Loading