From 187c17319a5f564addc5b6b5bd8d5b8b5fc2ce1d Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 26 Aug 2024 09:44:13 +0200 Subject: [PATCH] Take all Postgres platform classes into consideration --- composer.json | 4 ++-- .../Core/src/Visit/Listener/OrphanVisitsCountTracker.php | 7 ++++--- .../Core/src/Visit/Listener/ShortUrlVisitsCountTracker.php | 7 ++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index eadb894f..d6fb9d71 100644 --- a/composer.json +++ b/composer.json @@ -20,9 +20,9 @@ "ext-pdo": "*", "akrabat/ip-address-middleware": "^2.1", "cakephp/chronos": "^3.0.2", - "doctrine/dbal": "^4.0", + "doctrine/dbal": "^4.1", "doctrine/migrations": "^3.6", - "doctrine/orm": "^3.0", + "doctrine/orm": "^3.2", "endroid/qr-code": "^5.0", "friendsofphp/proxy-manager-lts": "^1.0", "geoip2/geoip2": "^3.0", diff --git a/module/Core/src/Visit/Listener/OrphanVisitsCountTracker.php b/module/Core/src/Visit/Listener/OrphanVisitsCountTracker.php index 157d587e..a673f19e 100644 --- a/module/Core/src/Visit/Listener/OrphanVisitsCountTracker.php +++ b/module/Core/src/Visit/Listener/OrphanVisitsCountTracker.php @@ -58,9 +58,10 @@ final class OrphanVisitsCountTracker $conn = $em->getConnection(); $platformClass = $conn->getDatabasePlatform(); - match ($platformClass::class) { - PostgreSQLPlatform::class => $this->incrementForPostgres($conn, $isBot), - SQLitePlatform::class, SQLServerPlatform::class => $this->incrementForOthers($conn, $isBot), + match (true) { + $platformClass instanceof PostgreSQLPlatform => $this->incrementForPostgres($conn, $isBot), + $platformClass instanceof SQLitePlatform || $platformClass instanceof SQLServerPlatform + => $this->incrementForOthers($conn, $isBot), default => $this->incrementForMySQL($conn, $isBot), }; } diff --git a/module/Core/src/Visit/Listener/ShortUrlVisitsCountTracker.php b/module/Core/src/Visit/Listener/ShortUrlVisitsCountTracker.php index f62ddb3d..0ab8d393 100644 --- a/module/Core/src/Visit/Listener/ShortUrlVisitsCountTracker.php +++ b/module/Core/src/Visit/Listener/ShortUrlVisitsCountTracker.php @@ -64,9 +64,10 @@ final class ShortUrlVisitsCountTracker $conn = $em->getConnection(); $platformClass = $conn->getDatabasePlatform(); - match ($platformClass::class) { - PostgreSQLPlatform::class => $this->incrementForPostgres($conn, $shortUrlId, $isBot), - SQLitePlatform::class, SQLServerPlatform::class => $this->incrementForOthers($conn, $shortUrlId, $isBot), + match (true) { + $platformClass instanceof PostgreSQLPlatform => $this->incrementForPostgres($conn, $shortUrlId, $isBot), + $platformClass instanceof SQLitePlatform || $platformClass instanceof SQLServerPlatform + => $this->incrementForOthers($conn, $shortUrlId, $isBot), default => $this->incrementForMySQL($conn, $shortUrlId, $isBot), }; }