From a62e9d4fb4213ccd8a2ef4583ccfea09c7420e5f Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 13 Jan 2024 04:23:55 +0200 Subject: [PATCH] fix crc32server value --- src/Controller/CrontabController.php | 13 ++++--------- src/Controller/ServerController.php | 6 +++--- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Controller/CrontabController.php b/src/Controller/CrontabController.php index ef915af..92eb39e 100644 --- a/src/Controller/CrontabController.php +++ b/src/Controller/CrontabController.php @@ -153,11 +153,6 @@ class CrontabController extends AbstractController $players = isset($info['Players']) && $info['Players'] > 0 ? (int) $info['Players'] - $bots : 0; $total = $players + $bots; - // Generate CRC32 server ID - $crc32server = crc32( - $server->host . ':' . $server->port - ); - // Update server name if (!empty($info['HostName']) && mb_strlen($info['HostName']) < 256) { @@ -183,7 +178,7 @@ class CrontabController extends AbstractController // Get last online value $online = $entityManagerInterface->getRepository(Online::class)->findOneBy( [ - 'crc32server' => $crc32server + 'crc32server' => $server->getCrc32server() ], [ 'id' => 'DESC' // same as online.time but faster @@ -205,7 +200,7 @@ class CrontabController extends AbstractController $online = new Online(); $online->setCrc32server( - $crc32server + $server->getCrc32server() ); $online->setTime( @@ -262,7 +257,7 @@ class CrontabController extends AbstractController $player = $entityManagerInterface->getRepository(Player::class)->findOneBy( [ - 'crc32server' => $crc32server, + 'crc32server' => $server->getCrc32server(), 'crc32name' => $crc32name, ] ); @@ -292,7 +287,7 @@ class CrontabController extends AbstractController $player = new Player(); $player->setCrc32server( - $crc32server + $server->getCrc32server() ); $player->setCrc32name( diff --git a/src/Controller/ServerController.php b/src/Controller/ServerController.php index 18f272a..a8e02b3 100644 --- a/src/Controller/ServerController.php +++ b/src/Controller/ServerController.php @@ -121,7 +121,7 @@ class ServerController extends AbstractController // Get online $online = $entityManagerInterface->getRepository(Online::class)->findBy( [ - 'crc32server' => $server->getCrc32Server() + 'crc32server' => $server->getCrc32server() ], 'online' == $request->get('sort') ? [$field => $order] : ['time' => 'DESC'], 10 @@ -130,7 +130,7 @@ class ServerController extends AbstractController // Get players $players = $entityManagerInterface->getRepository(Player::class)->findBy( [ - 'crc32server' => $server->getCrc32Server() + 'crc32server' => $server->getCrc32server() ], 'players' == $request->get('sort') ? [$field => $order] : ['frags' => 'DESC'], 10 @@ -168,7 +168,7 @@ class ServerController extends AbstractController 'server' => [ 'address' => $address, - 'crc32server' => $server->getCrc32Server(), + 'crc32server' => $server->getCrc32server(), 'name' => $server->getName(), 'host' => $server->getHost(), 'port' => $server->getPort(),