fix server deletion upon changing product (#789)

This commit is contained in:
Dennis 2023-04-14 10:18:25 +02:00 committed by GitHub
commit 8cda91a6e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -40,7 +40,7 @@ class ServerController extends Controller
foreach ($servers as $server) { foreach ($servers as $server) {
//Get server infos from ptero //Get server infos from ptero
$serverAttributes = $this->pterodactyl->getServerAttributes($server->pterodactyl_id, true); $serverAttributes = $this->pterodactyl->getServerAttributes($server->pterodactyl_id);
if (! $serverAttributes) { if (! $serverAttributes) {
continue; continue;
} }
@ -351,9 +351,7 @@ class ServerController extends Controller
$server->update(); $server->update();
$server->allocation = $serverAttributes['allocation']; $server->allocation = $serverAttributes['allocation'];
$response = $this->pterodactyl->updateServer($server, $newProduct); $response = $this->pterodactyl->updateServer($server, $newProduct);
if ($response->failed()) { if ($response->failed()) return redirect()->route('servers.index')->with('error', __("The system was unable to update your server product. Please try again later or contact support."));
return $this->serverCreationFailed($response, $server);
}
//update user balance //update user balance
$user->decrement('credits', $priceupgrade); $user->decrement('credits', $priceupgrade);
//restart the server //restart the server

View file

@ -460,5 +460,6 @@
"tr": "Turečtina", "tr": "Turečtina",
"ru": "Ruština", "ru": "Ruština",
"sv": "Švédština", "sv": "Švédština",
"sk": "Slovensky" "sk": "Slovensky",
"The system was unable to update your server product. Please try again later or contact support.": "Systém nebyl schopen změnit Váš balíček serveru. Prosím zkuste to znovu nebo kontaktujte podporu."
} }