From a945b613ede007d031a8bac24e28a4e81efb488a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 9 May 2026 00:53:29 +0000 Subject: [PATCH] chore: polish docs url constants and provisioning log clarity Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/020b5f73-a6ca-4a45-a4cb-eeef59cb26a8 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com> --- modules/billing/create_servers.php | 4 +++- modules/billing/payment_success.php | 1 + modules/gamemanager/server_monitor.php | 8 ++++++-- modules/support/support.php | 12 ++++++++---- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/modules/billing/create_servers.php b/modules/billing/create_servers.php index e2841c42..837dcc10 100644 --- a/modules/billing/create_servers.php +++ b/modules/billing/create_servers.php @@ -191,7 +191,8 @@ if (!function_exists('billing_write_provision_log')) { if (!is_dir($logDir)) { mkdir($logDir, 0755, true); } - $line = '[' . date('Y-m-d H:i:s') . '] ' . json_encode($context, JSON_UNESCAPED_SLASHES) . PHP_EOL; + $status = strtoupper((string)($context['install_result'] ?? 'INFO')); + $line = '[' . date('Y-m-d H:i:s') . '] [' . $status . '] ' . json_encode($context, JSON_UNESCAPED_SLASHES) . PHP_EOL; $result = file_put_contents($logDir . '/provisioning.log', $line, FILE_APPEND | LOCK_EX); if ($result === false) { error_log('billing_write_provision_log: failed to append provisioning.log'); @@ -333,6 +334,7 @@ function exec_ogp_module() if (empty($home_info)) { $order_failed = true; $order_failure_reason = "Order #{$order_id} references home_id {$home_id} but server_homes row is missing."; + $db->logger('BILLING PROVISION DATA INTEGRITY ERROR: ' . $order_failure_reason); } $existingIpPort = billing_get_home_ip_port($db, $db_prefix, intval($home_id)); if (!empty($existingIpPort['ok'])) { diff --git a/modules/billing/payment_success.php b/modules/billing/payment_success.php index 6a42c147..5a4a55ee 100644 --- a/modules/billing/payment_success.php +++ b/modules/billing/payment_success.php @@ -36,6 +36,7 @@ function billing_payment_success_provision_state(array $order): array if ($homeId <= 0) { return ['label' => 'PENDING', 'message' => 'Server record is queued for provisioning.', 'class' => 'status-badge status-pending']; } + // home_id exists but server_homes row does not: orphaned consistency failure. if (!$hasHome) { return ['label' => 'FAILED', 'message' => 'Provisioning error: billing order references a missing server home.', 'class' => 'status-badge status-failed']; } diff --git a/modules/gamemanager/server_monitor.php b/modules/gamemanager/server_monitor.php index 8b525717..44270fa8 100644 --- a/modules/gamemanager/server_monitor.php +++ b/modules/gamemanager/server_monitor.php @@ -29,6 +29,10 @@ require_once("modules/config_games/server_config_parser.php"); require_once("includes/refreshed.php"); require_once('includes/lib_remote.php'); +if (!defined('GSP_WEBSITE_DOCS_BASE_URL')) { + define('GSP_WEBSITE_DOCS_BASE_URL', 'https://gameservers.world/docs/'); +} + function renderParam($param, $last_param, $param_access_enabled, $home_id) { global $db; @@ -156,7 +160,7 @@ function get_sync_name($server_xml) function gsp_docs_url_for_game_key($game_key) { - $baseDocsUrl = 'https://gameservers.world/docs'; + $baseDocsUrl = rtrim(GSP_WEBSITE_DOCS_BASE_URL, '/'); $game_key = trim((string)$game_key); if ($game_key !== '') { $docPath = __DIR__ . '/../billing/docs/' . $game_key . '/index.php'; @@ -273,7 +277,7 @@ $home_info = $db->getGameHomeWithoutMods($home_id); $show_all = FALSE; } - $docsTarget = 'https://gameservers.world/docs/'; + $docsTarget = GSP_WEBSITE_DOCS_BASE_URL; if (is_array($home_info) && !empty($home_info['game_key'])) { $docsTarget = gsp_docs_url_for_game_key($home_info['game_key']); } diff --git a/modules/support/support.php b/modules/support/support.php index 3fc641b6..13014c72 100644 --- a/modules/support/support.php +++ b/modules/support/support.php @@ -20,11 +20,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - */ +*/ + +if (!defined('GSP_WEBSITE_DOCS_BASE_URL')) { + define('GSP_WEBSITE_DOCS_BASE_URL', 'https://gameservers.world/docs/'); +} function gsp_support_docs_url_for_game_key($game_key) { - $baseDocsUrl = 'https://gameservers.world/docs'; + $baseDocsUrl = rtrim(GSP_WEBSITE_DOCS_BASE_URL, '/'); $game_key = trim((string)$game_key); if ($game_key !== '') { $docPath = __DIR__ . '/../billing/docs/' . $game_key . '/index.php'; @@ -94,7 +98,7 @@ if (!empty($webhook)) { } // end if submit echo ''; echo "