Skip to content

Commit 289099f

Browse files
committed
MessageDataLoader types
1 parent 0a9b9a4 commit 289099f

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

src/Domain/Messaging/Model/Dto/MessagePrecacheDto.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ class MessagePrecacheDto
2626
// public string $htmlCharset= 'UTF-8';
2727
// public string $textCharset= 'UTF-8';
2828
public bool $userSpecificUrl = false;
29-
public ?string $googleTrack = null;
29+
public bool $googleTrack = false;
3030
public array $adminAttributes = [];
3131
}

src/Domain/Messaging/Service/MessageDataLoader.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use PhpList\Core\Domain\Messaging\Repository\MessageRepository;
1212
use Psr\Log\LoggerInterface;
1313

14+
// todo: check types
1415
class MessageDataLoader
1516
{
1617
private const AS_FORMAT_FIELDS = ['astext', 'ashtml', 'astextandhtml', 'aspdf', 'astextandpdf'];
@@ -70,9 +71,9 @@ private function buildDefaultMessageData(): array
7071
'textmessage' => '',
7172
'rsstemplate' => '',
7273
'embargo' => $this->getDateArray(),
73-
'repeatinterval' => 0,
74+
'repeatinterval' => '0',
7475
'repeatuntil' => $this->getDateArray(),
75-
'requeueinterval' => 0,
76+
'requeueinterval' => '0',
7677
'requeueuntil' => $this->getDateArray(),
7778
'finishsending' => $this->getDateArray($finishSending),
7879
'fromfield' => '',
@@ -95,7 +96,7 @@ private function buildDefaultMessageData(): array
9596
filter: FILTER_VALIDATE_BOOL
9697
),
9798
'excludelist' => [],
98-
'sentastest' => 0,
99+
'sentastest' => '0',
99100
];
100101
}
101102

src/Domain/Messaging/Service/MessagePrecacheService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(
4444
* Retrieve the base (unpersonalized) message content for a campaign from cache,
4545
* or cache it on first access. Handle [URL:] token fetch and basic placeholder replacements.
4646
*/
47-
public function precacheMessage(Message $campaign, $loadedMessageData, ?bool $forwardContent = false): bool
47+
public function precacheMessage(Message $campaign, array $loadedMessageData, ?bool $forwardContent = false): bool
4848
{
4949
$cacheKey = sprintf('messaging.message.base.%d.%d', $campaign->getId(), (int) $forwardContent);
5050
$cached = $this->cache->get($cacheKey);
@@ -65,7 +65,7 @@ public function precacheMessage(Message $campaign, $loadedMessageData, ?bool $fo
6565

6666
//# if we are sending a URL that contains user attributes, we cannot pre-parse the message here
6767
//# but that has quite some impact on speed. So check if that's the case and apply
68-
$messagePrecacheDto->userSpecificUrl = preg_match('/\[.+\]/', $loadedMessageData['sendurl']);
68+
$messagePrecacheDto->userSpecificUrl = (bool) preg_match('/\[.+\]/', $loadedMessageData['sendurl']);
6969

7070
if (!$this->applyRemoteContentIfPresent($messagePrecacheDto, $loadedMessageData)) {
7171
return false;

src/Migrations/Version20260204094237.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,11 @@ public function up(Schema $schema): void
3131
get_class($platform)
3232
));
3333

34-
$this->addSql('ALTER TABLE phplist_linktrack_forward ALTER url TYPE VARCHAR(255)');
35-
3634
$this->addSql('ALTER TABLE phplist_message ALTER astext TYPE INT USING astext::integer');
3735
$this->addSql('ALTER TABLE phplist_message ALTER ashtml TYPE INT USING ashtml::integer');
3836
$this->addSql('ALTER TABLE phplist_message ALTER aspdf TYPE INT USING aspdf::integer');
3937
$this->addSql('ALTER TABLE phplist_message ALTER astextandhtml TYPE INT USING astextandhtml::integer');
4038
$this->addSql('ALTER TABLE phplist_message ALTER astextandpdf TYPE INT USING astextandpdf::integer');
41-
42-
$this->addSql('ALTER TABLE phplist_urlcache ALTER url TYPE VARCHAR(255)');
4339
}
4440

4541
public function down(Schema $schema): void
@@ -50,14 +46,10 @@ public function down(Schema $schema): void
5046
get_class($platform)
5147
));
5248

53-
$this->addSql('ALTER TABLE phplist_linktrack_forward ALTER url TYPE VARCHAR(2083)');
54-
5549
$this->addSql('ALTER TABLE phplist_message ALTER astext TYPE BOOLEAN USING (astext::integer <> 0)');
5650
$this->addSql('ALTER TABLE phplist_message ALTER ashtml TYPE BOOLEAN USING (ashtml::integer <> 0)');
5751
$this->addSql('ALTER TABLE phplist_message ALTER aspdf TYPE BOOLEAN USING (aspdf::integer <> 0)');
5852
$this->addSql('ALTER TABLE phplist_message ALTER astextandhtml TYPE BOOLEAN USING (astextandhtml::integer <> 0)');
5953
$this->addSql('ALTER TABLE phplist_message ALTER astextandpdf TYPE BOOLEAN USING (astextandpdf::integer <> 0)');
60-
61-
$this->addSql('ALTER TABLE phplist_urlcache ALTER url TYPE VARCHAR(2083)');
6254
}
6355
}

0 commit comments

Comments
 (0)