Panel/docs/modules/UPDATE.md
2026-06-06 12:21:56 -05:00

73 lines
3.4 KiB
Markdown

# Update Module
## Role
`Panel/modules/update` exposes the admin Panel update page. The page delegates most update behavior to:
- `Panel/modules/administration/panel_update.php`
## Current Behavior
The update page is intentionally simple:
- shows the installed Panel version
- shows the current git branch and commit when available
- exposes editable repository settings
- can create a backup
- can update from the configured repository and branch
- can roll back to an existing backup
- keeps Apache diagnostics in a collapsed Advanced Diagnostics section
## Update Settings
The admin page stores these settings in the Panel settings table:
- `gsp_update_repo_url` for the repository source. This may be a Git URL or a safe absolute local repository path.
- `gsp_update_branch`
- `gsp_update_repo_root`
- `gsp_update_panel_path`
- `gsp_update_backup_before`
Defaults:
- Repository URL / Path: `http://forge.runlevelsystems.com/dev/GSP.git`
- Branch: `Panel-unstable`
- Repository Root: `/var/www/html/GSP`
- Panel Path: `/var/www/html/GSP/Panel`
- Backup Before Update: enabled
Important implementation note:
- `gsp_update_settings()` and `gsp_validate_update_settings()` are defined at top level in `Panel/modules/administration/panel_update.php`.
- These helpers must not be nested inside another function. A previous bad edit placed `gsp_update_settings()` inside `gsp_get_git_commit()`, which caused a fatal error when the update page called the helper before `gsp_get_git_commit()` had ever executed.
- If the update page throws `Call to undefined function gsp_update_settings()`, first verify the deployed `Panel/modules/administration/panel_update.php` matches the repository version and that this helper exists near the top of the file before `gsp_panel_update_section()` is called.
## Update Flow
1. Save or submit repository settings.
2. Validate repository URL, branch, repo root, and Panel path.
3. Run preflight against the configured paths.
4. Create a backup when enabled.
5. Clone the configured repository source and branch into a temporary checkout.
6. Sync files into the configured root/Panel paths.
7. Preserve `Panel/includes/config.inc.php`.
8. Run module updates/post-update hooks.
9. Write version metadata and `LAST_UPDATE.txt`.
## Diagnostics
Apache and SSL checks are diagnostics only. Missing SSL certificates do not block Panel updates.
The old repeated SSL vhost disable buttons are not part of the primary update page. Apache path repair remains available under Advanced Diagnostics, and SSL issues are shown as concise diagnostic warnings.
## Remaining Issues
- The updater still contains legacy GitHub release helper code that is no longer rendered by the simplified primary UI.
- Real production testing should confirm file ownership and web-server permissions on `/var/www/html/GSP`.
## Repair Notes
- The update page fatal `Call to undefined function gsp_update_settings()` means the deployed `Panel/modules/administration/panel_update.php` is missing the top-level helper or is not the current repository copy.
- `Panel/modules/update/update.php` only loads `Panel/modules/administration/panel_update.php` and calls `gsp_panel_update_section()`.
- The configured update action uses `git clone --depth 1 --branch <configured branch> <configured repository source> <temporary checkout>`.
- Clone failures are logged to `logs/update_trace.log` with the configured repository source and branch.