Merge pull request #121 from GameServerPanel/copilot/fix-gsp-update-module-issues

This commit is contained in:
Frank Harris 2026-05-05 07:38:23 -05:00 committed by GitHub
commit 0a3dd271f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 46 additions and 3 deletions

View file

@ -205,6 +205,12 @@ function update_module($db, $module_id, $module)
{
if(isset($install_queries))
{
if (!array_key_exists($i+1, $install_queries))
{
trigger_error("Module '" . preg_replace('/[^a-zA-Z0-9_\-]/', '', $module) . "': no migration queries defined for db_version step " . ($i+1) . " skipping.", E_USER_NOTICE);
++$i;
continue;
}
foreach ((array)$install_queries[$i+1] as $query)
{
// Support PHP callables in addition to plain SQL strings.

View file

@ -0,0 +1,37 @@
<?php
/*
* GSP Steam Workshop: monitor page button
* Copyright (C) 2025 WDS / GameServerPanel
*
* Adds a "Steam Workshop" button to the game/server monitor page when:
* - the game's Workshop profile is enabled in steam_workshop_game_profiles, AND
* - the current user owns the server or is an admin.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
$module_buttons = array();
// Only show the button when a Workshop profile is enabled for this game config.
$_sw_profile = $db->resultQuery(
"SELECT p.id
FROM OGP_DB_PREFIXsteam_workshop_game_profiles p
JOIN OGP_DB_PREFIXconfig_homes c ON c.game_key = p.config_name
JOIN OGP_DB_PREFIXserver_homes s ON s.home_cfg_id = c.home_cfg_id
WHERE s.home_id = " . (int)$server_home['home_id'] . "
AND p.enabled = 1
LIMIT 1"
);
if (!empty($_sw_profile)) {
$module_buttons[] = "<a class='monitorbutton' href='home.php?m=steam_workshop&amp;p=user&amp;home_id=" . (int)$server_home['home_id'] . "'>
<img src='" . htmlspecialchars(check_theme_image("images/steam_workshop.png"), ENT_QUOTES, 'UTF-8') . "' title='Steam Workshop'>
<span>Steam Workshop</span>
</a>";
}
unset($_sw_profile);
?>

View file

@ -2,5 +2,5 @@
<!-- Admin: manage Steam Workshop game profiles -->
<page key="admin" file="admin.php" access="admin" />
<!-- User: manage per-server mods -->
<page key="user_mods" file="user.php" access="admin,user,subuser" />
<page key="user" file="user.php" access="admin,user,subuser" />
</navigation>

View file

@ -3,7 +3,7 @@
* GSP Steam Workshop: User mod management
* Copyright (C) 2025 WDS / GameServerPanel
*
* Accessible via: home.php?m=steam_workshop&p=user_mods&home_id=123
* Accessible via: home.php?m=steam_workshop&p=user&home_id=123
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -307,7 +307,7 @@ function sw_user_render($db, $home_id, array $home, array $profile)
});
$params = sw_generate_launch_params(array_values($enabled_mods), $profile);
$base_url = 'home.php?m=steam_workshop&p=user_mods&home_id=' . $home_id;
$base_url = 'home.php?m=steam_workshop&p=user&home_id=' . $home_id;
?>
<p>