feat: CLI snapshots, auto-verify integrity, snapshot REST API (#55, #65, #54) #90

Merged
jmiller merged 3 commits from feat/batch-55-65-54 into main 2026-06-22 00:46:52 +00:00
Owner

Summary

Three features. Closes #55, closes #65, closes #54.

#55: CLI snapshot command

mokosuitebackup:snapshot with four actions:

  • create --types=articles,categories,modules --description="text"
  • restore --id=N --mode=replace|merge
  • list — formatted table output
  • delete --id=N

#65: Auto-verify backup integrity

After archive creation + checksum, automatically verifies:

  • Archive opens without error
  • Has entries, database.sql present for DB backups
  • First entry readable (spot-check)
    Applied to both BackupEngine and SteppedBackupEngine.

#54: Snapshot REST API

Five endpoints via Joomla REST API:

  • GET /snapshots — list with pagination
  • POST /snapshot — create
  • POST /snapshot/:id/restore — restore (mode + types)
  • DELETE /snapshot/:id — delete
  • GET /snapshot/:id/download — stream JSON

Test Plan

  • CLI: bin/joomla mokosuitebackup:snapshot create --types=articles
  • CLI: bin/joomla mokosuitebackup:snapshot list shows table
  • CLI: bin/joomla mokosuitebackup:snapshot restore --id=1 --mode=merge
  • Backup creates successfully and log shows "Archive integrity verified"
  • Corrupt archive triggers verification failure
  • API: GET /api/index.php/v1/mokosuitebackup/snapshots returns list
  • API: POST /api/index.php/v1/mokosuitebackup/snapshot creates snapshot
## Summary Three features. Closes #55, closes #65, closes #54. ### #55: CLI snapshot command `mokosuitebackup:snapshot` with four actions: - `create --types=articles,categories,modules --description="text"` - `restore --id=N --mode=replace|merge` - `list` — formatted table output - `delete --id=N` ### #65: Auto-verify backup integrity After archive creation + checksum, automatically verifies: - Archive opens without error - Has entries, `database.sql` present for DB backups - First entry readable (spot-check) Applied to both `BackupEngine` and `SteppedBackupEngine`. ### #54: Snapshot REST API Five endpoints via Joomla REST API: - `GET /snapshots` — list with pagination - `POST /snapshot` — create - `POST /snapshot/:id/restore` — restore (mode + types) - `DELETE /snapshot/:id` — delete - `GET /snapshot/:id/download` — stream JSON ## Test Plan - [ ] CLI: `bin/joomla mokosuitebackup:snapshot create --types=articles` - [ ] CLI: `bin/joomla mokosuitebackup:snapshot list` shows table - [ ] CLI: `bin/joomla mokosuitebackup:snapshot restore --id=1 --mode=merge` - [ ] Backup creates successfully and log shows "Archive integrity verified" - [ ] Corrupt archive triggers verification failure - [ ] API: `GET /api/index.php/v1/mokosuitebackup/snapshots` returns list - [ ] API: `POST /api/index.php/v1/mokosuitebackup/snapshot` creates snapshot
jmiller added the component: enginecomponent: api labels 2026-06-22 00:46:24 +00:00
jmiller added 3 commits 2026-06-22 00:46:24 +00:00
Add `mokosuitebackup:snapshot` command with four actions:
- create: --types=articles,categories,modules --description="text"
- restore: --id=N --mode=replace|merge --types=articles
- list: displays table of all snapshots
- delete: --id=N removes file + DB record

Closes #55
After archive is created and checksum computed, automatically verify:
- Archive opens without error
- Contains at least one entry
- database.sql present when backup type includes database
- First entry is readable (spot-check)

Applied to both BackupEngine and SteppedBackupEngine. Throws
RuntimeException on verification failure (backup marked as failed).

Closes #65
feat: REST API endpoints for content snapshots (#54)
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 2s
Joomla: Extension CI / Release Readiness Check (pull_request) Failing after 6s
Universal: PR Check / Validate PR (pull_request) Failing after 6s
Universal: PR Check / Secret Scan (pull_request) Successful in 10s
Generic: Repo Health / Access control (pull_request) Successful in 1s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Successful in 15s
Universal: Build & Release / Promote to RC (pull_request) Has been skipped
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Branch Cleanup / Delete merged branch (pull_request) Successful in 2s
Joomla: Extension CI / Lint & Validate (pull_request) Failing after 39s
Universal: Build & Release / Build & Release Pipeline (pull_request) Successful in 17s
Universal: Workflow Sync Trigger / Sync workflows to live repos (pull_request) Failing after 1m49s
c72e950a25
Add five endpoints matching the existing backup API pattern:
- GET /snapshots — list with pagination
- POST /snapshot — create (content_types, description)
- POST /snapshot/:id/restore — restore (mode, content_types)
- DELETE /snapshot/:id — delete record + file
- GET /snapshot/:id/download — stream JSON file

ACL: mokosuitebackup.snapshot.manage for write ops, core.manage for read.
Routes registered in webservices plugin alongside backup routes.

Closes #54
jmiller merged commit 35b7e2a0b8 into main 2026-06-22 00:46:52 +00:00
jmiller deleted branch feat/batch-55-65-54 2026-06-22 00:46:54 +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#90