Conversation
This feature adds a comprehensive Update Manager similar to Mainsail's update system, allowing administrators to update Part-DB directly from the web interface. Features: - Web UI at /admin/update-manager showing current and available versions - Support for Git-based installations with automatic update execution - Maintenance mode during updates to prevent user access - Automatic database backup before updates - Git rollback points for recovery (tags created before each update) - Progress tracking with real-time status updates - Update history and log viewing - Downgrade support with appropriate UI messaging - CLI command `php bin/console partdb:update` for server-side updates New files: - UpdateManagerController: Handles all web UI routes - UpdateCommand: CLI command for running updates - UpdateExecutor: Core update execution logic with safety mechanisms - UpdateChecker: GitHub API integration for version checking - InstallationTypeDetector: Detects installation type (Git/Docker/ZIP) - MaintenanceModeSubscriber: Blocks user access during maintenance - UpdateExtension: Twig functions for update notifications UI improvements: - Update notification in navbar for admins when update available - Confirmation dialogs for update/downgrade actions - Downgrade-specific text throughout the interface - Progress page with auto-refresh
- Bump permission schema to version 4 - Add upgradeSchemaToVersion4 for manage_updates permission - Grants manage_updates to users who have both show_updates and server_infos - Fix ZIP_RELEASE installation type: set supportsAutoUpdate to false (ZIP update not yet implemented) - Improve update instructions for ZIP installations
When downgrading to versions before v2.6.0, show a warning that the Update Manager will not be available in older versions and that future updates will need to be done manually via command line.
The previous implementation used inline onsubmit handlers with return confirmVersionChange(...), which could fail silently if any JavaScript error occurred on the page, causing the form to submit without confirmation. Fixes: - Use event.preventDefault() FIRST to ensure form never submits by default - Use DOMContentLoaded event listeners instead of inline handlers - Properly escape translation strings using json_encode filter - Wrap in IIFE with 'use strict' for better error handling - Use data-attributes to identify forms and pass isDowngrade state Fix DOMContentLoaded race condition in update form handlers The event listener was not attaching if DOMContentLoaded had already fired by the time the script executed. Now checks document.readyState and attaches handlers immediately if DOM is already ready. Added console.log statements to help debug form handler attachment. Use Stimulus controller for update confirmation dialogs The inline script was blocked by Content Security Policy (CSP). Stimulus controllers are bundled with webpack and properly allowed by CSP. - Create update_confirm_controller.js Stimulus controller - Remove inline script from template - Pass translation strings via data-* attributes
- Add restoreBackup() method to UpdateExecutor with full restore workflow - Add getBackupDetails() to retrieve backup metadata and contents info - Add restore controller routes (backup details API, restore action) - Add restore button to backups table in UI - Create backup_restore_controller.js Stimulus controller for confirmation - Add translation strings for restore feature The restore process: 1. Acquires lock and enables maintenance mode 2. Extracts backup to temp directory 3. Restores database (MySQL/PostgreSQL SQL or SQLite file) 4. Optionally restores config files and attachments 5. Clears and warms cache 6. Disables maintenance mode Fix backup restore database import The restore feature was using a non-existent doctrine:database:import command. Now properly uses mysql/psql commands directly to import database dumps. Changes: - Add EntityManagerInterface dependency to UpdateExecutor - Use mysql command with shell input redirection for MySQL restore - Use psql -f command for PostgreSQL restore - Properly handle database connection parameters - Add error handling for failed imports
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1217 +/- ##
============================================
- Coverage 58.23% 55.33% -2.90%
- Complexity 7435 7752 +317
============================================
Files 582 589 +7
Lines 23656 24947 +1291
============================================
+ Hits 13775 13805 +30
- Misses 9881 11142 +1261 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Otherwise we run into an error message that web profiler does not exist
|
Hey, thanks for the PR, it looks very cool and amazing. Some general remarks:
|
Merged new Conrad info provider and generic web provider translations from upstream while keeping Update Manager translations.
Changes based on maintainer feedback from PR Part-DB#1217: 1. Add yarn install/build steps to update process - Added yarn availability check in validateUpdatePreconditions - Added yarn install and yarn build steps after composer install - Added yarn rebuild to rollback process - Updated total steps count from 12 to 14 2. Add environment variables to disable web features - DISABLE_WEB_UPDATES: Completely disable web-based updates - DISABLE_BACKUP_RESTORE: Disable backup restore from web UI - Added checks in controller and template 3. Extract BackupManager service - New service handles backup creation, listing, details, and restoration - UpdateExecutor now delegates backup operations to BackupManager - Cleaner separation of concerns for future reuse 4. Merge upstream/master and resolve translation conflicts - Added Conrad info provider and generic web provider translations - Kept Update Manager translations
Combined jbtronics' debug mode handling for composer install with our yarn install/build steps and BackupManager refactoring.
Tests cover: - BackupManager: backup directory, listing, details parsing - UpdateExecutor: lock/unlock, maintenance mode, validation, progress
|
Thanks, glad you like it! I've addressed all the points: 1. Yarn install/build steps
2. Environment variable to disable web updates
3. Extracted BackupManager service
4. Backup restore permission/control
5. Automated tests
|
… but include that for new databases
… in GitVersionInfoProvider service
This can become default, when there is more experience with the web updated
…ake it more consistent with other hyphen command tools
|
So i did some optimizations of the code during the more detailed review. If everythings works, i can merge the PR. It would be good, if there is some documentation to the update features. For now i would keep it under an experimental status, I have disabled by default for now. If there was some experienced gathered how reliable everything works for the end user, we can make it enabled by default. |
- Add comprehensive update_manager.md with feature overview - Document CLI commands (partdb:update, partdb:maintenance-mode) - Document web interface and permissions - Add security considerations and troubleshooting - Update console_commands.md with new commands
|
Thanks for the review and optimizations! I've tested everything and all 17 tests pass. I've also added documentation:
The documentation notes the experimental status and that web updates are disabled by default. Also improved the |
Clarify that 0=enabled and 1=disabled for DISABLE_WEB_UPDATES and DISABLE_BACKUP_RESTORE environment variables.
…eature/update-manager
…t it is properly cleared on cache clear
|
I merged the PR. Thanks again for your PR. |
It is me that should thank you for making Part DB possible, thank you very much for that! You are making a fantastic job! |
Summary
This PR adds a comprehensive Update Manager similar to Mainsail's update system, allowing administrators to update Part-DB directly from the web interface.
Key Features
/admin/update-managershowing current and available versionsphp bin/console partdb:updatefor server-side updatesNew Components
UpdateManagerController: Handles all web UI routesUpdateCommand: CLI command for running updatesUpdateExecutor: Core update execution logic with safety mechanismsUpdateChecker: GitHub API integration for version checkingInstallationTypeDetector: Detects installation type (Git/Docker/ZIP)UpdateExtension: Twig functions for update notificationsUI Improvements
Permissions
@system.manage_updates(automatically granted to users withshow_updatesandserver_infos)Safety Features
Installation Type Support
Test Plan
Screenshots
The interface shows available updates, current version, update history, and backup management with restore functionality.