feat: Pre-flight checks before backup starts (#67) #70

Merged
jmiller merged 4 commits from feature/67-preflight-checks into main 2026-06-21 22:54:34 +00:00
Owner

Summary

Validates backup prerequisites before creating any backup record, catching common issues early with clear messages instead of failing mid-backup.

Closes #67

Pre-flight Checks

Check Type Details
PHP extensions Error zip, pdo, pdo_mysql, mbstring (curl warned if remote/ntfy)
Backup directory Error Exists, writable, attempts creation
Disk space Warning Last backup size + 20% buffer (skipped if no previous backup)
Running backup Error No other backup running for same profile
Excluded tables Warning Warns if excluded tables don't exist in DB
Remote credentials Warning FTP host/user, S3 bucket/keys, GDrive OAuth configured
Profile state Error Profile exists and is published

Errors block the backup. Warnings are logged and shown but allow the backup to proceed.

Integration Points

  • BackupEngine::run() — preflight runs before record insert
  • SteppedBackupEngine::init() — preflight runs before record insert
  • BackupsController::start() — surfaces warnings as Joomla messages
  • AJAX init response — includes warnings array for JS modal display

New File

  • src/Engine/PreflightCheck.php — standalone, reusable by both engines

Test Plan

  • Backup with valid profile succeeds normally
  • Backup with unpublished profile shows error, no record created
  • Backup with non-writable directory shows error, no record created
  • Backup while another is running shows error, no record created
  • Backup with missing excluded table shows warning but succeeds
  • Backup with unconfigured FTP shows warning but succeeds
  • Low disk space shows warning in modal but backup proceeds
  • AJAX stepped backup shows warnings in progress modal
## Summary Validates backup prerequisites **before** creating any backup record, catching common issues early with clear messages instead of failing mid-backup. Closes #67 ## Pre-flight Checks | Check | Type | Details | |-------|------|---------| | PHP extensions | Error | zip, pdo, pdo_mysql, mbstring (curl warned if remote/ntfy) | | Backup directory | Error | Exists, writable, attempts creation | | Disk space | Warning | Last backup size + 20% buffer (skipped if no previous backup) | | Running backup | Error | No other backup running for same profile | | Excluded tables | Warning | Warns if excluded tables don't exist in DB | | Remote credentials | Warning | FTP host/user, S3 bucket/keys, GDrive OAuth configured | | Profile state | Error | Profile exists and is published | **Errors** block the backup. **Warnings** are logged and shown but allow the backup to proceed. ## Integration Points - `BackupEngine::run()` — preflight runs before record insert - `SteppedBackupEngine::init()` — preflight runs before record insert - `BackupsController::start()` — surfaces warnings as Joomla messages - AJAX init response — includes `warnings` array for JS modal display ## New File - `src/Engine/PreflightCheck.php` — standalone, reusable by both engines ## Test Plan - [ ] Backup with valid profile succeeds normally - [ ] Backup with unpublished profile shows error, no record created - [ ] Backup with non-writable directory shows error, no record created - [ ] Backup while another is running shows error, no record created - [ ] Backup with missing excluded table shows warning but succeeds - [ ] Backup with unconfigured FTP shows warning but succeeds - [ ] Low disk space shows warning in modal but backup proceeds - [ ] AJAX stepped backup shows warnings in progress modal
jmiller added the component: engine label 2026-06-21 22:47:29 +00:00
jmiller added 2 commits 2026-06-21 22:47:30 +00:00
feat: add pre-flight checks before backup starts (#67)
Universal: Auto Version Bump / Version Bump (push) Successful in 9s
edb202071c
Validate backup prerequisites before creating any record, catching
common issues early with clear messages instead of failing mid-backup.

Pre-flight checks:
- Required PHP extensions (zip, pdo, pdo_mysql, mbstring, curl)
- Backup directory exists and is writable
- Sufficient disk space (last backup size + 20% buffer, skipped if
  no previous backup exists)
- No other backup already running for this profile
- Excluded tables exist in database (warns on missing)
- Remote storage credentials minimally configured (FTP/S3/GDrive)

Errors block the backup; warnings are logged and displayed but allow
the backup to proceed. Integrated into both BackupEngine::run() and
SteppedBackupEngine::init() before any record is inserted.

UI: AJAX init response includes warnings array, displayed in the
stepped backup progress modal.

Closes #67
jmiller added 1 commit 2026-06-21 22:54:15 +00:00
fix: address PR review — remove dead code, consistent warnings key
Joomla: Extension CI / Tests (PHP 8.2) (pull_request) Blocked by required conditions
Joomla: Extension CI / Tests (PHP 8.3) (pull_request) Blocked by required conditions
Joomla: Extension CI / PHPStan Analysis (pull_request) Blocked by required conditions
Joomla: Extension CI / Build RC Pre-Release (pull_request) Blocked by required conditions
Universal: PR Check / Build RC Package (pull_request) Blocked by required conditions
Universal: PR Check / Report Issues (pull_request) Blocked by required conditions
Generic: Repo Health / Scripts governance (pull_request) Blocked by required conditions
Generic: Repo Health / Repository health (pull_request) Blocked by required conditions
Generic: Repo Health / Report Issues (pull_request) Blocked by required conditions
Universal: PR Check / Branch Policy (pull_request) Failing after 1s
Joomla: Extension CI / Release Readiness Check (pull_request) Failing after 4s
Generic: Repo Health / Access control (pull_request) Successful in 2s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Joomla: Extension CI / Lint & Validate (pull_request) Failing after 7s
Universal: PR Check / Validate PR (pull_request) Failing after 5s
Universal: PR Check / Secret Scan (pull_request) Successful in 6s
Universal: Auto Version Bump / Version Bump (push) Successful in 12s
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Successful in 35s
dbed0d0da7
- Remove dead checkRequiredExtensions() method (superseded by PreflightCheck)
- Add 'warnings' key to ALL return paths in BackupEngine::run() and
  SteppedBackupEngine::init() to prevent undefined key access on PHP 8.x
- Include preflight warnings in success, failure, and early-exit returns
jmiller added 1 commit 2026-06-21 22:54:30 +00:00
chore(version): auto-bump patch 01.26.02-dev [skip ci]
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Branch Cleanup / Delete merged branch (pull_request) Successful in 1s
Universal: Build & Release / Promote to RC (pull_request) Has been skipped
Universal: Build & Release / Build & Release Pipeline (pull_request) Successful in 18s
Universal: Workflow Sync Trigger / Sync workflows to live repos (pull_request) Failing after 2m35s
f099ad8fe9
jmiller merged commit a532e639ea into main 2026-06-21 22:54:34 +00:00
jmiller deleted branch feature/67-preflight-checks 2026-06-21 22:54:35 +00:00
Sign in to join this conversation.
No Reviewers
Priority -
Type -
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoSuiteBackup#70