Merge pull request #164 from GameServerPanel/copilot/diagnose-deployment-issues

This commit is contained in:
Frank Harris 2026-05-19 15:36:33 -05:00 committed by GitHub
commit 68d06253fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 11 deletions

View file

@ -1,6 +1,7 @@
# Changelog
## 2026-05-19
- **Updater deployment diagnostics + legacy updater Panel path compatibility:** Update UI now surfaces configured stable/unstable branches plus the last resolved temporary checkout/source repo paths used during deployment, and `modules/update/updating.php` now treats `Panel/` and `panel/` zip paths equivalently so legacy update routes no longer skip panel files from current GitHub zip layouts.
- **Updater deployment layout enforcement + marker file writes:** Hardened `modules/administration/panel_update.php` to require the live `/var/www/html/GSP` root with explicit `/Panel` and `/Website` destinations, log full source/destination path detection (including temp checkout/source roots), stop on invalid mapping, copy Panel/Website via explicit subtree mapping (preventing nested `Panel/Panel` or `Website/Website`), validate key copied files after sync, and write both `Website/timestamp.txt` and `modules/billing/timestamp.txt` marker files on successful updates.
- **Workshop content script path fix:** Updated addonsmanager default Workshop script paths to the panel module script location under `/var/www/html/GSP/Panel/modules/addonsmanager/scripts/workshop/` so Workshop actions no longer use the incorrect game-home-mixed path on the agent host.

View file

@ -22,3 +22,4 @@
- Add localized language strings/tooltips for the new cron scheduler `server_content_*` action labels across all supported panel locales.
- Add a Game Manager "Live Server Status" panel that consumes `Panel/protocol/gsp_query.php` and shows banner preview plus copyable embed code.
- Add an updater admin UI table that renders the full deployment preflight path map (temp checkout, source repo/panel/website, destination panel/website) directly from the new layout detection payload for one-click operator verification.
- Add an updater integration test fixture that calls both `home.php?m=update` and legacy `home.php?m=update&p=updating&version=<branch>` against a `Panel-unstable` zipball and asserts changed `Panel/modules/` files are actually copied.

View file

@ -967,6 +967,7 @@ gsp_rmdir_recursive($temp_dir);
return ['success' => false, 'error' => 'Deployment layout validation failed: ' . implode(' | ', $resolved_layout['errors'])];
}
$layout = $resolved_layout['layout'];
$_SESSION['gsp_last_update_layout'] = $layout;
$updater_version = substr((string)@hash_file('sha256', $layout['source_panel_path'] . '/modules/administration/panel_update.php'), 0, 12);
$drift_files = gsp_detect_updater_drift_files($layout['source_repo_root'], GSP_ROOT_DIR);
@ -1816,6 +1817,9 @@ $csrf_token = $_SESSION['gsp_update_csrf'];
$current_version = gsp_get_current_version();
$current_branch = gsp_get_current_branch();
$git_commit = gsp_get_git_commit();
$last_layout = isset($_SESSION['gsp_last_update_layout']) && is_array($_SESSION['gsp_last_update_layout'])
? $_SESSION['gsp_last_update_layout']
: null;
$vinfo = gsp_read_version_json();
$releases = gsp_fetch_github_releases($repo_owner, $repo_name);
$latest_release = (is_array($releases) && !empty($releases)) ? htmlspecialchars($releases[0]['tag_name']) : 'N/A';
@ -1836,7 +1840,14 @@ echo "<tr><td><strong>Expected Root:</strong></td><td><code>" . htmlspecialchars
echo "<tr><td><strong>Detected GSP Root:</strong></td><td><code>" . htmlspecialchars(GSP_ROOT_DIR) . "</code></td></tr>\n";
echo "<tr><td><strong>Panel Path:</strong></td><td><code>" . htmlspecialchars(GSP_PANEL_DIR) . "</code></td></tr>\n";
echo "<tr><td><strong>Website Path:</strong></td><td><code>" . htmlspecialchars(GSP_WEBSITE_DIR) . "</code></td></tr>\n";
echo "<tr><td><strong>Configured Stable Branch:</strong></td><td><code>" . htmlspecialchars($stable_branch) . "</code></td></tr>\n";
echo "<tr><td><strong>Configured Unstable Branch:</strong></td><td><code>" . htmlspecialchars($unstable_branch) . "</code></td></tr>\n";
echo "<tr><td><strong>Update Trace Log:</strong></td><td><code>" . htmlspecialchars(GSP_UPDATE_LOG) . "</code></td></tr>\n";
if ($last_layout) {
echo "<tr><td><strong>Last Temp Checkout Path:</strong></td><td><code>" . htmlspecialchars(isset($last_layout['temporary_git_checkout_path']) ? $last_layout['temporary_git_checkout_path'] : '') . "</code></td></tr>\n";
echo "<tr><td><strong>Last Source Repo Root:</strong></td><td><code>" . htmlspecialchars(isset($last_layout['source_repo_root']) ? $last_layout['source_repo_root'] : '') . "</code></td></tr>\n";
echo "<tr><td><strong>Last Source Panel Path:</strong></td><td><code>" . htmlspecialchars(isset($last_layout['source_panel_path']) ? $last_layout['source_panel_path'] : '') . "</code></td></tr>\n";
}
echo "</table><br>\n";
echo "<h3>Current Installation</h3>\n";

View file

@ -156,21 +156,20 @@ function exec_ogp_module()
$i = 0;
foreach ((array)$result['extracted_files'] as $file)
{
$filename = str_replace( $unwanted_path, "" , $file['filename'] );
$filename = str_replace("\\", "/", $filename);
// New repository layout uses /panel as source subtree; ignore everything else.
if (strpos($filename, '/panel/') === 0) {
$filename = substr($filename, strlen('/panel'));
} elseif (strpos($filename, 'panel/') === 0) {
$filename = substr($filename, strlen('panel'));
if ($filename === '' || $filename[0] !== '/') $filename = '/' . $filename;
} else {
$zip_filename = str_replace("\\", "/", $file['filename']);
$source_relative = str_replace( $unwanted_path, "" , $zip_filename );
$source_relative = ltrim($source_relative, "/");
// Repository layout uses Panel/ (uppercase in current zipballs, lowercase in some legacy builds).
if (stripos($source_relative, 'panel/') !== 0) {
continue;
}
if ($filename === '') {
$panel_relative = substr($source_relative, strlen('panel/'));
$panel_relative = ltrim((string)$panel_relative, "/");
if ($panel_relative === '') {
continue;
}
$temp_file = $extract_path . DIRECTORY_SEPARATOR . $filename;
$filename = '/' . $panel_relative;
$temp_file = $extract_path . DIRECTORY_SEPARATOR . $source_relative;
$web_file = $baseDir . $filename;
if( file_exists( $web_file ) )