BackupManager
Orchestrates one backup "run": a {@see DatabaseDumperInterface} dump plus a {@see StorageArchiver} archive, recorded as a `{id}.manifest.json` file in `$backupDir` alongside the `.sql`/`.tar.gz` it produced. {@see BackupCatalog} reads those manifests back; this class is the only writer of new ones. `run()` never throws: a failed dump or archive is caught and reported as a non-`ok` {@see BackupReport} instead, so a scheduled/cron caller always gets a report to act on rather than an uncaught exception mid-run.
BackupManager::__construct()
public function __construct(string $backupDir, Milpa\Ops\Backup\DatabaseDumperInterface $dumper, Milpa\Ops\Backup\StorageArchiver $archiver):Parameters
| Name | Type | Description |
|---|---|---|
| $backupDir | string | |
| $dumper | Milpa\Ops\Backup\DatabaseDumperInterface | |
| $archiver | Milpa\Ops\Backup\StorageArchiver |
BackupManager::run()
public function run(string $id, string $createdAtIso): Milpa\Ops\Backup\BackupReportDump the database, archive storage, and write the manifest — all under `$id`. Always returns a {@see BackupReport}; a failure mid-run is captured in it (`ok: false`, `error` set) rather than propagated as an exception.
Parameters
| Name | Type | Description |
|---|---|---|
| $id | string | |
| $createdAtIso | string |
BackupManager::restore()
public function restore(string $id): voidRestore the database and storage from a previously completed backup. Confirming this destructive action with the operator is the caller's job (the command), not this method's — by the time `restore()` runs, it executes unconditionally.
Parameters
| Name | Type | Description |
|---|---|---|
| $id | string |
Throws
RuntimeException if `$id` has no manifest, or its database dump is missing