fix server upgrade while installation
This commit is contained in:
parent
dd962a0afb
commit
680ffefb1e
|
@ -389,6 +389,9 @@ class ServerController extends Controller
|
|||
$server->allocation = $serverAttributes['allocation'];
|
||||
$response = $this->pterodactyl->updateServer($server, $newProduct);
|
||||
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."));
|
||||
//restart the server
|
||||
$response = $this->pterodactyl->powerAction($server, 'restart');
|
||||
if ($response->failed()) return redirect()->route('servers.index')->with('error', 'Upgrade Failed! Could not restart the server: ' . $response->json()['errors'][0]['detail']);
|
||||
|
||||
// Remove the allocation property from the server object as it is not a column in the database
|
||||
unset($server->allocation);
|
||||
|
@ -406,9 +409,6 @@ class ServerController extends Controller
|
|||
// Withdraw the credits for the new product
|
||||
$user->decrement('credits', $newProduct->price);
|
||||
|
||||
//restart the server
|
||||
$response = $this->pterodactyl->powerAction($server, 'restart');
|
||||
if ($response->failed()) return redirect()->route('servers.index')->with('error', 'Server upgraded successfully! Could not restart the server: ' . $response->json()['errors'][0]['detail']);
|
||||
return redirect()->route('servers.show', ['server' => $server->id])->with('success', __('Server Successfully Upgraded'));
|
||||
} else {
|
||||
return redirect()->route('servers.show', ['server' => $server->id])->with('error', __('Not Enough Balance for Upgrade'));
|
||||
|
|
Loading…
Reference in a new issue