From 34335f790fb9acb65cff6172b6bc1e12092590b2 Mon Sep 17 00:00:00 2001 From: Marcellus Siegburg <531939+marcellussiegburg@users.noreply.github.com> Date: Thu, 29 Jan 2026 15:39:17 +0100 Subject: [PATCH 1/2] Make SQL queries PostgreSQL compatible --- Classes/Domain/Repository/LogRepository.php | 96 +++++++++---------- Classes/Domain/Repository/QueueRepository.php | 2 +- Classes/Domain/Repository/UserRepository.php | 8 +- .../Domain/Repository/UsergroupRepository.php | 6 +- 4 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Classes/Domain/Repository/LogRepository.php b/Classes/Domain/Repository/LogRepository.php index 09957446..8d51599f 100644 --- a/Classes/Domain/Repository/LogRepository.php +++ b/Classes/Domain/Repository/LogRepository.php @@ -25,14 +25,14 @@ class LogRepository extends AbstractRepository public function getNumberOfReceivers(Filter $filter): int { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = 'select count(distinct user) ' - . ' from ' . Log::TABLE_NAME . ' l' - . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' - . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' - . ' where l.deleted=0 and l.status=' . Log::STATUS_DISPATCH - . ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")' - . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp() - . ' limit 1'; + $sql = "select count(distinct user) " + . " from " . Log::TABLE_NAME . " l" + . " left join " . Newsletter::TABLE_NAME . " nl on nl.uid=l.newsletter" + . " left join " . Configuration::TABLE_NAME . " c on nl.configuration=c.uid" + . " where l.deleted=0 and l.status=" . Log::STATUS_DISPATCH + . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" + . " and nl.crdate>" . $filter->getTimeDateStart()->getTimestamp() + . " limit 1"; return (int)$connection->executeQuery($sql)->fetchOne(); } @@ -52,16 +52,16 @@ public function getNumberOfReceivers(Filter $filter): int public function getGroupedLinksByHref(Filter $filter): array { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = 'select count(*) as count, l.properties, l.newsletter, MAX(l.uid) uid' - . ' from ' . Log::TABLE_NAME . ' l' - . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' - . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' - . ' where l.deleted=0 and l.status=' . Log::STATUS_LINKOPENING - . ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")' - . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp() - . ' group by l.properties, l.newsletter' - . ' order by count desc' - . ' limit ' . $filter->getLimit(); + $sql = "select count(*) as count, l.properties, l.newsletter, MAX(l.uid) uid" + . " from " . Log::TABLE_NAME . " l" + . " left join " . Newsletter::TABLE_NAME . " nl on nl.uid=l.newsletter" + . " left join " . Configuration::TABLE_NAME . " c on nl.configuration=c.uid" + . " where l.deleted=0 and l.status=" . Log::STATUS_LINKOPENING + . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" + . " and nl.crdate>" . $filter->getTimeDateStart()->getTimestamp() + . " group by l.properties, l.newsletter" + . " order by count desc" + . " limit " . $filter->getLimit(); $results = $connection->executeQuery($sql)->fetchAllAssociative(); $nlRepository = GeneralUtility::makeInstance(NewsletterRepository::class); foreach ($results as &$result) { @@ -79,14 +79,14 @@ public function getGroupedLinksByHref(Filter $filter): array public function getOverallOpenings(Filter $filter): int { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = 'select count(distinct newsletter, user)' - . ' from ' . Log::TABLE_NAME . ' l' - . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' - . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' - . ' where l.deleted = 0' - . ' and l.status IN (' . Log::STATUS_NEWSLETTEROPENING . ',' . Log::STATUS_LINKOPENING . ')' - . ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")' - . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp(); + $sql = "select count(distinct (newsletter, user))" + . " from " . Log::TABLE_NAME . " l" + . " left join " . Newsletter::TABLE_NAME . " nl on nl.uid=l.newsletter" + . " left join " . Configuration::TABLE_NAME . " c on nl.configuration=c.uid" + . " where l.deleted = 0" + . " and l.status IN (" . Log::STATUS_NEWSLETTEROPENING . "," . Log::STATUS_LINKOPENING . ")" + . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" + . " and nl.crdate>" . $filter->getTimeDateStart()->getTimestamp(); return (int)$connection->executeQuery($sql)->fetchOne(); } @@ -98,13 +98,13 @@ public function getOverallOpenings(Filter $filter): int public function getOpeningsByClickers(Filter $filter): int { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = 'select count(distinct newsletter, user)' - . ' from ' . Log::TABLE_NAME . ' l' - . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' - . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' - . ' where l.deleted = 0 and l.status=' . Log::STATUS_LINKOPENING - . ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")' - . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp(); + $sql = "select count(distinct (newsletter, user))" + . " from " . Log::TABLE_NAME . " l" + . " left join " . Newsletter::TABLE_NAME . " nl on nl.uid=l.newsletter" + . " left join " . Configuration::TABLE_NAME . " c on nl.configuration=c.uid" + . " where l.deleted = 0 and l.status=" . Log::STATUS_LINKOPENING + . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" + . " and nl.crdate>" . $filter->getTimeDateStart()->getTimestamp(); return (int)$connection->executeQuery($sql)->fetchOne(); } @@ -147,13 +147,13 @@ public function getOverallMailsSent(Filter $filter): int protected function getOverallAmountByLogStatus(array $status, Filter $filter): int { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = 'select count(l.uid)' - . ' from ' . Log::TABLE_NAME . ' l' - . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' - . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' - . ' where l.deleted = 0 and l.status in (' . ArrayUtility::convertArrayToIntegerList($status) . ')' - . ' and c.site in ("' . implode('","', $filter->getSitesForFilter()) . '")' - . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp(); + $sql = "select count(l.uid)" + . " from " . Log::TABLE_NAME . " l" + . " left join " . Newsletter::TABLE_NAME . " nl on nl.uid=l.newsletter" + . " left join " . Configuration::TABLE_NAME . " c on nl.configuration=c.uid" + . " where l.deleted = 0 and l.status in (" . ArrayUtility::convertArrayToIntegerList($status) . ")" + . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" + . " and nl.crdate>" . $filter->getTimeDateStart()->getTimestamp(); return (int)$connection->executeQuery($sql)->fetchOne(); } @@ -275,7 +275,7 @@ public function isLogRecordExisting(int $newsletterIdentifier, int $userIdentifi $uid = (int)$queryBuilder ->select('uid') ->from(Log::TABLE_NAME) - ->where('newsletter=' . $newsletterIdentifier . ' and user=' . $userIdentifier . ' and status=' . $status) + ->where("newsletter=" . (int)$newsletterIdentifier . " and user='" . (int)$userIdentifier . "' and status='" . (int)$status . "'") ->setMaxResults(1) ->executeQuery() ->fetchOne(); @@ -294,11 +294,11 @@ public function findByNewsletterAndStatus(Newsletter $newsletter, array $status, $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); $sqlSelectColumns = '*'; if ($distinctMails === true) { - $sqlSelectColumns = 'distinct newsletter, user'; + $sqlSelectColumns = 'distinct (newsletter, user)'; } return $connection->executeQuery( - 'select ' . $sqlSelectColumns . ' from ' . Log::TABLE_NAME . - ' where deleted=0 and status in (' . implode(',', $status) . ') and newsletter=' . $newsletter->getUid() + "select " . $sqlSelectColumns . " from " . Log::TABLE_NAME . + " where deleted=0 and status in (" . implode(",", $status) . ") and newsletter=" . (int)$newsletter->getUid() )->fetchAllAssociative(); } @@ -312,13 +312,13 @@ public function findByNewsletterAndStatus(Newsletter $newsletter, array $status, public function findRawByUser(User $user, array $statusWhitelist = [], array $statusBlacklist = []): array { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = 'select * from ' . Log::TABLE_NAME . ' where deleted=0 and user=' . $user->getUid(); + $sql = "select * from " . Log::TABLE_NAME . " where deleted=0 and user='" . (int)$user->getUid() . "'"; if ($statusWhitelist !== []) { - $sql .= ' and status in (' . implode(',', $statusWhitelist) . ')'; + $sql .= " and status in (" . implode(",", $statusWhitelist) . ")"; } elseif ($statusBlacklist !== []) { - $sql .= ' and status not in (' . implode(',', $statusBlacklist) . ')'; + $sql .= " and status not in (" . implode(",", $statusBlacklist) . ")"; } - $sql .= ' order by crdate desc'; + $sql .= " order by crdate desc"; return (array)$connection->executeQuery($sql)->fetchAllAssociative(); } diff --git a/Classes/Domain/Repository/QueueRepository.php b/Classes/Domain/Repository/QueueRepository.php index 2d4e2db7..b9e595a8 100644 --- a/Classes/Domain/Repository/QueueRepository.php +++ b/Classes/Domain/Repository/QueueRepository.php @@ -94,7 +94,7 @@ public function isUserAndNewsletterAlreadyAddedToQueue(User $user, Newsletter $n return (int)$queryBuilder ->select('uid') ->from(Queue::TABLE_NAME) - ->where('newsletter=' . $newsletter->getUid() . ' and user=' . $user->getUid()) + ->where("newsletter=" . (int)$newsletter->getUid() . " and user='" . (int)$user->getUid() . "'") ->setMaxResults(1) ->executeQuery() ->fetchOne() > 0; diff --git a/Classes/Domain/Repository/UserRepository.php b/Classes/Domain/Repository/UserRepository.php index 176ecdff..425d8fb0 100644 --- a/Classes/Domain/Repository/UserRepository.php +++ b/Classes/Domain/Repository/UserRepository.php @@ -88,15 +88,15 @@ public function getUserAmountFromGroups(array $groupIdentifiers): int if ($groupIdentifiers !== []) { $connection = DatabaseUtility::getConnectionForTable(User::TABLE_NAME); /** @noinspection SqlDialectInspection */ - $sql = 'select count(distinct email) from ' . User::TABLE_NAME; + $sql = "select count(distinct email) from " . User::TABLE_NAME; $sub = ''; foreach ($groupIdentifiers as $identifier) { if ($sub !== '') { - $sub .= ' or '; + $sub .= " or "; } - $sub .= 'find_in_set(' . (int)$identifier . ',usergroup)'; + $sub = "((',' || usergroup || ',') LIKE '%," . (int)$identifier . ",%')"; } - $sql .= ' where deleted=0 and disable=0 and email like "%@%" and (' . $sub . ')'; + $sql .= " where deleted=0 and disable=0 and email like '%@%' and (" . $sub . ")"; return (int)$connection->executeQuery($sql)->fetchOne(); } return 0; diff --git a/Classes/Domain/Repository/UsergroupRepository.php b/Classes/Domain/Repository/UsergroupRepository.php index a10f405b..b7941942 100644 --- a/Classes/Domain/Repository/UsergroupRepository.php +++ b/Classes/Domain/Repository/UsergroupRepository.php @@ -19,9 +19,9 @@ public function findByIdentifiersAndKeepOrderings(array $usergroupIdentifiers): $result = []; if ($usergroupIdentifiers !== []) { $connection = DatabaseUtility::getConnectionForTable(Usergroup::TABLE_NAME); - $sql = 'select * from ' . Usergroup::TABLE_NAME - . ' where uid in (' . ArrayUtility::convertArrayToIntegerList($usergroupIdentifiers) . ')' - . ' order by FIELD(uid, ' . ArrayUtility::convertArrayToIntegerList($usergroupIdentifiers) . ')'; + $sql = "select * from " . Usergroup::TABLE_NAME + . " where uid in (" . ArrayUtility::convertArrayToIntegerList($usergroupIdentifiers) . ")" + . " order by FIELD(uid, " . ArrayUtility::convertArrayToIntegerList($usergroupIdentifiers) . ")"; $records = $connection->executeQuery($sql)->fetchAllAssociative(); foreach ($records as $record) { $user = $this->findByUid($record['uid']); From d20e4b63fb68949da3f5b9caf7b1266d95e72f66 Mon Sep 17 00:00:00 2001 From: Marcellus Siegburg <531939+marcellussiegburg@users.noreply.github.com> Date: Thu, 29 Jan 2026 20:02:59 +0100 Subject: [PATCH 2/2] Apply php-cs-fixer --- Classes/Domain/Repository/LogRepository.php | 84 +++++++++---------- Classes/Domain/Repository/QueueRepository.php | 2 +- Classes/Domain/Repository/UserRepository.php | 6 +- .../Domain/Repository/UsergroupRepository.php | 6 +- ext_emconf.php | 10 +-- 5 files changed, 54 insertions(+), 54 deletions(-) diff --git a/Classes/Domain/Repository/LogRepository.php b/Classes/Domain/Repository/LogRepository.php index 8d51599f..b27727f4 100644 --- a/Classes/Domain/Repository/LogRepository.php +++ b/Classes/Domain/Repository/LogRepository.php @@ -25,14 +25,14 @@ class LogRepository extends AbstractRepository public function getNumberOfReceivers(Filter $filter): int { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = "select count(distinct user) " - . " from " . Log::TABLE_NAME . " l" - . " left join " . Newsletter::TABLE_NAME . " nl on nl.uid=l.newsletter" - . " left join " . Configuration::TABLE_NAME . " c on nl.configuration=c.uid" - . " where l.deleted=0 and l.status=" . Log::STATUS_DISPATCH + $sql = 'select count(distinct user) ' + . ' from ' . Log::TABLE_NAME . ' l' + . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' + . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' + . ' where l.deleted=0 and l.status=' . Log::STATUS_DISPATCH . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" - . " and nl.crdate>" . $filter->getTimeDateStart()->getTimestamp() - . " limit 1"; + . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp() + . ' limit 1'; return (int)$connection->executeQuery($sql)->fetchOne(); } @@ -52,16 +52,16 @@ public function getNumberOfReceivers(Filter $filter): int public function getGroupedLinksByHref(Filter $filter): array { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = "select count(*) as count, l.properties, l.newsletter, MAX(l.uid) uid" - . " from " . Log::TABLE_NAME . " l" - . " left join " . Newsletter::TABLE_NAME . " nl on nl.uid=l.newsletter" - . " left join " . Configuration::TABLE_NAME . " c on nl.configuration=c.uid" - . " where l.deleted=0 and l.status=" . Log::STATUS_LINKOPENING + $sql = 'select count(*) as count, l.properties, l.newsletter, MAX(l.uid) uid' + . ' from ' . Log::TABLE_NAME . ' l' + . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' + . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' + . ' where l.deleted=0 and l.status=' . Log::STATUS_LINKOPENING . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" - . " and nl.crdate>" . $filter->getTimeDateStart()->getTimestamp() - . " group by l.properties, l.newsletter" - . " order by count desc" - . " limit " . $filter->getLimit(); + . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp() + . ' group by l.properties, l.newsletter' + . ' order by count desc' + . ' limit ' . $filter->getLimit(); $results = $connection->executeQuery($sql)->fetchAllAssociative(); $nlRepository = GeneralUtility::makeInstance(NewsletterRepository::class); foreach ($results as &$result) { @@ -79,14 +79,14 @@ public function getGroupedLinksByHref(Filter $filter): array public function getOverallOpenings(Filter $filter): int { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = "select count(distinct (newsletter, user))" - . " from " . Log::TABLE_NAME . " l" - . " left join " . Newsletter::TABLE_NAME . " nl on nl.uid=l.newsletter" - . " left join " . Configuration::TABLE_NAME . " c on nl.configuration=c.uid" - . " where l.deleted = 0" - . " and l.status IN (" . Log::STATUS_NEWSLETTEROPENING . "," . Log::STATUS_LINKOPENING . ")" + $sql = 'select count(distinct (newsletter, user))' + . ' from ' . Log::TABLE_NAME . ' l' + . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' + . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' + . ' where l.deleted = 0' + . ' and l.status IN (' . Log::STATUS_NEWSLETTEROPENING . ',' . Log::STATUS_LINKOPENING . ')' . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" - . " and nl.crdate>" . $filter->getTimeDateStart()->getTimestamp(); + . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp(); return (int)$connection->executeQuery($sql)->fetchOne(); } @@ -98,13 +98,13 @@ public function getOverallOpenings(Filter $filter): int public function getOpeningsByClickers(Filter $filter): int { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = "select count(distinct (newsletter, user))" - . " from " . Log::TABLE_NAME . " l" - . " left join " . Newsletter::TABLE_NAME . " nl on nl.uid=l.newsletter" - . " left join " . Configuration::TABLE_NAME . " c on nl.configuration=c.uid" - . " where l.deleted = 0 and l.status=" . Log::STATUS_LINKOPENING + $sql = 'select count(distinct (newsletter, user))' + . ' from ' . Log::TABLE_NAME . ' l' + . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' + . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' + . ' where l.deleted = 0 and l.status=' . Log::STATUS_LINKOPENING . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" - . " and nl.crdate>" . $filter->getTimeDateStart()->getTimestamp(); + . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp(); return (int)$connection->executeQuery($sql)->fetchOne(); } @@ -147,13 +147,13 @@ public function getOverallMailsSent(Filter $filter): int protected function getOverallAmountByLogStatus(array $status, Filter $filter): int { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = "select count(l.uid)" - . " from " . Log::TABLE_NAME . " l" - . " left join " . Newsletter::TABLE_NAME . " nl on nl.uid=l.newsletter" - . " left join " . Configuration::TABLE_NAME . " c on nl.configuration=c.uid" - . " where l.deleted = 0 and l.status in (" . ArrayUtility::convertArrayToIntegerList($status) . ")" + $sql = 'select count(l.uid)' + . ' from ' . Log::TABLE_NAME . ' l' + . ' left join ' . Newsletter::TABLE_NAME . ' nl on nl.uid=l.newsletter' + . ' left join ' . Configuration::TABLE_NAME . ' c on nl.configuration=c.uid' + . ' where l.deleted = 0 and l.status in (' . ArrayUtility::convertArrayToIntegerList($status) . ')' . " and c.site in ('" . implode("','", $filter->getSitesForFilter()) . "')" - . " and nl.crdate>" . $filter->getTimeDateStart()->getTimestamp(); + . ' and nl.crdate>' . $filter->getTimeDateStart()->getTimestamp(); return (int)$connection->executeQuery($sql)->fetchOne(); } @@ -275,7 +275,7 @@ public function isLogRecordExisting(int $newsletterIdentifier, int $userIdentifi $uid = (int)$queryBuilder ->select('uid') ->from(Log::TABLE_NAME) - ->where("newsletter=" . (int)$newsletterIdentifier . " and user='" . (int)$userIdentifier . "' and status='" . (int)$status . "'") + ->where('newsletter=' . (int)$newsletterIdentifier . " and user='" . (int)$userIdentifier . "' and status='" . (int)$status . "'") ->setMaxResults(1) ->executeQuery() ->fetchOne(); @@ -297,8 +297,8 @@ public function findByNewsletterAndStatus(Newsletter $newsletter, array $status, $sqlSelectColumns = 'distinct (newsletter, user)'; } return $connection->executeQuery( - "select " . $sqlSelectColumns . " from " . Log::TABLE_NAME . - " where deleted=0 and status in (" . implode(",", $status) . ") and newsletter=" . (int)$newsletter->getUid() + 'select ' . $sqlSelectColumns . ' from ' . Log::TABLE_NAME . + ' where deleted=0 and status in (' . implode(',', $status) . ') and newsletter=' . (int)$newsletter->getUid() )->fetchAllAssociative(); } @@ -312,13 +312,13 @@ public function findByNewsletterAndStatus(Newsletter $newsletter, array $status, public function findRawByUser(User $user, array $statusWhitelist = [], array $statusBlacklist = []): array { $connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME); - $sql = "select * from " . Log::TABLE_NAME . " where deleted=0 and user='" . (int)$user->getUid() . "'"; + $sql = 'select * from ' . Log::TABLE_NAME . " where deleted=0 and user='" . (int)$user->getUid() . "'"; if ($statusWhitelist !== []) { - $sql .= " and status in (" . implode(",", $statusWhitelist) . ")"; + $sql .= ' and status in (' . implode(',', $statusWhitelist) . ')'; } elseif ($statusBlacklist !== []) { - $sql .= " and status not in (" . implode(",", $statusBlacklist) . ")"; + $sql .= ' and status not in (' . implode(',', $statusBlacklist) . ')'; } - $sql .= " order by crdate desc"; + $sql .= ' order by crdate desc'; return (array)$connection->executeQuery($sql)->fetchAllAssociative(); } diff --git a/Classes/Domain/Repository/QueueRepository.php b/Classes/Domain/Repository/QueueRepository.php index b9e595a8..0ee20a7d 100644 --- a/Classes/Domain/Repository/QueueRepository.php +++ b/Classes/Domain/Repository/QueueRepository.php @@ -94,7 +94,7 @@ public function isUserAndNewsletterAlreadyAddedToQueue(User $user, Newsletter $n return (int)$queryBuilder ->select('uid') ->from(Queue::TABLE_NAME) - ->where("newsletter=" . (int)$newsletter->getUid() . " and user='" . (int)$user->getUid() . "'") + ->where('newsletter=' . (int)$newsletter->getUid() . " and user='" . (int)$user->getUid() . "'") ->setMaxResults(1) ->executeQuery() ->fetchOne() > 0; diff --git a/Classes/Domain/Repository/UserRepository.php b/Classes/Domain/Repository/UserRepository.php index 425d8fb0..288dd63b 100644 --- a/Classes/Domain/Repository/UserRepository.php +++ b/Classes/Domain/Repository/UserRepository.php @@ -88,15 +88,15 @@ public function getUserAmountFromGroups(array $groupIdentifiers): int if ($groupIdentifiers !== []) { $connection = DatabaseUtility::getConnectionForTable(User::TABLE_NAME); /** @noinspection SqlDialectInspection */ - $sql = "select count(distinct email) from " . User::TABLE_NAME; + $sql = 'select count(distinct email) from ' . User::TABLE_NAME; $sub = ''; foreach ($groupIdentifiers as $identifier) { if ($sub !== '') { - $sub .= " or "; + $sub .= ' or '; } $sub = "((',' || usergroup || ',') LIKE '%," . (int)$identifier . ",%')"; } - $sql .= " where deleted=0 and disable=0 and email like '%@%' and (" . $sub . ")"; + $sql .= " where deleted=0 and disable=0 and email like '%@%' and (" . $sub . ')'; return (int)$connection->executeQuery($sql)->fetchOne(); } return 0; diff --git a/Classes/Domain/Repository/UsergroupRepository.php b/Classes/Domain/Repository/UsergroupRepository.php index b7941942..a10f405b 100644 --- a/Classes/Domain/Repository/UsergroupRepository.php +++ b/Classes/Domain/Repository/UsergroupRepository.php @@ -19,9 +19,9 @@ public function findByIdentifiersAndKeepOrderings(array $usergroupIdentifiers): $result = []; if ($usergroupIdentifiers !== []) { $connection = DatabaseUtility::getConnectionForTable(Usergroup::TABLE_NAME); - $sql = "select * from " . Usergroup::TABLE_NAME - . " where uid in (" . ArrayUtility::convertArrayToIntegerList($usergroupIdentifiers) . ")" - . " order by FIELD(uid, " . ArrayUtility::convertArrayToIntegerList($usergroupIdentifiers) . ")"; + $sql = 'select * from ' . Usergroup::TABLE_NAME + . ' where uid in (' . ArrayUtility::convertArrayToIntegerList($usergroupIdentifiers) . ')' + . ' order by FIELD(uid, ' . ArrayUtility::convertArrayToIntegerList($usergroupIdentifiers) . ')'; $records = $connection->executeQuery($sql)->fetchAllAssociative(); foreach ($records as $record) { $user = $this->findByUid($record['uid']); diff --git a/ext_emconf.php b/ext_emconf.php index 15470c41..9d6474f5 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -11,14 +11,14 @@ 'state' => 'stable', 'constraints' => [ 'depends' => [ - 'typo3' => '12.4.0-13.4.99' + 'typo3' => '12.4.0-13.4.99', ], 'conflicts' => [ - 'news' => '9.0.0-10.99.99' + 'news' => '9.0.0-10.99.99', ], 'suggests' => [ 'lux' => '0.0.0-0.0.0', - 'dashboard' => '0.0.0-0.0.0' - ] - ] + 'dashboard' => '0.0.0-0.0.0', + ], + ], ];