Return all servers for a node as a paginated response

Avoids crashing the PHP process and avoids a bad runaway N+1 query issue that previously existed.
This commit is contained in:
Dane Everitt 2020-10-31 11:14:28 -07:00
parent 73b795faba
commit c00e5b36a5
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 56 additions and 57 deletions

View file

@ -7,8 +7,6 @@ use Pterodactyl\Models\Server;
class ServerConfigurationStructureService
{
const REQUIRED_RELATIONS = ['allocation', 'allocations', 'egg'];
/**
* @var \Pterodactyl\Services\Servers\EnvironmentService
*/
@ -31,13 +29,11 @@ class ServerConfigurationStructureService
* daemon, if you modify the structure eggs will break unexpectedly.
*
* @param \Pterodactyl\Models\Server $server
* @param bool $legacy
* @param bool $legacy deprecated
* @return array
*/
public function handle(Server $server, bool $legacy = false): array
{
$server->loadMissing(self::REQUIRED_RELATIONS);
return $legacy ?
$this->returnLegacyFormat($server)
: $this->returnCurrentFormat($server);
@ -93,6 +89,7 @@ class ServerConfigurationStructureService
*
* @param \Pterodactyl\Models\Server $server
* @return array
* @deprecated
*/
protected function returnLegacyFormat(Server $server)
{