chore: apply final provisioning review cleanups
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/a39ca073-858c-4e1e-978f-09caabb0f029 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
41a1bcf16f
commit
c09b6737d9
3 changed files with 15 additions and 2 deletions
|
|
@ -48,6 +48,13 @@ if (!function_exists('billing_should_regenerate_provision_password')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('billing_agent_offline_reason')) {
|
||||
function billing_agent_offline_reason(int $remote_server_id, array $home_info): string
|
||||
{
|
||||
return "Agent is offline for remote server #{$remote_server_id} (" . ($home_info['agent_ip'] ?? 'unknown') . ":" . ($home_info['agent_port'] ?? 'unknown') . ").";
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('billing_invoke_provision')) {
|
||||
function billing_invoke_provision(array $options = array())
|
||||
{
|
||||
|
|
@ -486,6 +493,8 @@ function exec_ogp_module()
|
|||
$order_failure_reason = "Could not create server_homes row for order #{$order_id}.";
|
||||
}
|
||||
if (!$order_failed) {
|
||||
// Billing storefront defaults to FTP enabled for newly provisioned homes
|
||||
// so panel/account flows remain consistent immediately after checkout.
|
||||
$db->changeFtpStatus('enabled', intval($home_id));
|
||||
}
|
||||
|
||||
|
|
@ -589,7 +598,7 @@ function exec_ogp_module()
|
|||
}
|
||||
if (empty($autoInstall['ok'])) {
|
||||
if (stripos((string)($autoInstall['message'] ?? ''), 'Agent is offline') !== false) {
|
||||
$order_failure_reason = "Agent is offline for remote server #{$remote_server_id} (" . ($home_info['agent_ip'] ?? 'unknown') . ":" . ($home_info['agent_port'] ?? 'unknown') . ").";
|
||||
$order_failure_reason = billing_agent_offline_reason(intval($remote_server_id), (array)$home_info);
|
||||
}
|
||||
$order_failed = true;
|
||||
$order_failure_reason = $order_failure_reason !== '' ? $order_failure_reason : ("Server files have not been installed yet. " . ($autoInstall['message'] ?? 'Auto install could not be started.'));
|
||||
|
|
@ -706,7 +715,7 @@ function exec_ogp_module()
|
|||
}
|
||||
if (empty($autoInstall['ok'])) {
|
||||
if (stripos((string)($autoInstall['message'] ?? ''), 'Agent is offline') !== false) {
|
||||
$order_failure_reason = "Agent is offline for remote server #{$remote_server_id} (" . ($home_info['agent_ip'] ?? 'unknown') . ":" . ($home_info['agent_port'] ?? 'unknown') . ").";
|
||||
$order_failure_reason = billing_agent_offline_reason(intval($remote_server_id), (array)$home_info);
|
||||
}
|
||||
$order_failed = true;
|
||||
$order_failure_reason = $order_failure_reason !== '' ? $order_failure_reason : ("Server files have not been installed yet. " . ($autoInstall['message'] ?? 'Auto install could not be started.'));
|
||||
|
|
|
|||
|
|
@ -449,6 +449,8 @@ echo "<table id='servermonitor' class='tablesorter' data-sortlist='[[0,0],[3,1]]
|
|||
if (empty($server_home['ip']) || empty($server_home['port'])) {
|
||||
$home_ip_ports = $db->getHomeIpPorts(intval($server_home['home_id']));
|
||||
if (!empty($home_ip_ports) && is_array($home_ip_ports)) {
|
||||
// Preference order: exact mod-specific mapping, generic force_mod_id=0 mapping,
|
||||
// then first available mapping so newly provisioned homes always show an endpoint.
|
||||
$fallback_ip_port = null;
|
||||
foreach ((array)$home_ip_ports as $ip_port_row) {
|
||||
if (intval($ip_port_row['force_mod_id'] ?? 0) === intval($server_home['mod_id'] ?? 0)) {
|
||||
|
|
|
|||
|
|
@ -173,6 +173,8 @@ function exec_ogp_module()
|
|||
billing_invoke_provision(array(
|
||||
'order_ids' => array(intval($billing_order_id)),
|
||||
'user_id' => intval($web_user_id),
|
||||
// Trusted internal panel flow; allows admin-context provisioning
|
||||
// without requiring a customer session/login redirect trigger.
|
||||
'is_admin' => true
|
||||
));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue