Browse Source

show cached stats even server offline

main
ghost 11 months ago
parent
commit
fa4c8b9717
  1. 38
      src/Controller/ServerController.php

38
src/Controller/ServerController.php

@ -74,8 +74,24 @@ class ServerController extends AbstractController
// Init defaults // Init defaults
$info = []; $info = [];
$session = []; $session = [];
$online = [];
$players = []; // Get online
$online = $entityManagerInterface->getRepository(Online::class)->findBy(
[
'crc32server' => $server->getCrc32server()
],
'online' == $request->get('sort') ? [$field => $order] : ['time' => 'DESC'],
10
);
// Get players
$players = $entityManagerInterface->getRepository(Player::class)->findBy(
[
'crc32server' => $server->getCrc32server()
],
'players' == $request->get('sort') ? [$field => $order] : ['frags' => 'DESC'],
10
);
// Format address // Format address
if (false === filter_var($server->getHost(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) if (false === filter_var($server->getHost(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
@ -117,24 +133,6 @@ class ServerController extends AbstractController
$session $session
); );
} }
// Get online
$online = $entityManagerInterface->getRepository(Online::class)->findBy(
[
'crc32server' => $server->getCrc32server()
],
'online' == $request->get('sort') ? [$field => $order] : ['time' => 'DESC'],
10
);
// Get players
$players = $entityManagerInterface->getRepository(Player::class)->findBy(
[
'crc32server' => $server->getCrc32server()
],
'players' == $request->get('sort') ? [$field => $order] : ['frags' => 'DESC'],
10
);
} }
$status = true; $status = true;

Loading…
Cancel
Save