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>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-09 00:53:29 +00:00 committed by GitHub
parent 05d7bfba78
commit a945b613ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 7 deletions

View file

@ -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'])) {

View file

@ -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'];
}

View file

@ -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']);
}

View file

@ -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 '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA==" crossorigin="anonymous" referrerpolicy="no-referrer" />';
echo "<h2>".get_lang('support')."</h2>";
$defaultDocsUrl = 'https://gameservers.world/docs/';
$defaultDocsUrl = GSP_WEBSITE_DOCS_BASE_URL;
if (!empty($server_homes) && is_array($server_homes)) {
foreach ((array)$server_homes as $server_home_row) {
if (!empty($server_home_row['game_key'])) {
@ -168,7 +172,7 @@ if (!empty($webhook)) {
$(document).ready(function(){
function updateSupportDocLink(){
var selected = $('#gameserver option:selected');
var url = selected.data('doc-url') || 'https://gameservers.world/docs/';
var url = selected.data('doc-url') || '<?php echo GSP_WEBSITE_DOCS_BASE_URL; ?>';
$('#support-doc-link').attr('href', url);
}
$('#gameserver').on('change', updateSupportDocLink);