Skip to content
docsv0.1.1

BackupCatalog

Reads the `{id}.manifest.json` files a {@see BackupManager} run leaves behind in a backup directory, and prunes the oldest ones. Stateless and filesystem-only — the manifest files themselves are the catalog; there is no separate index to keep in sync.

BackupCatalog::__construct()

public function __construct(string $backupDir):

Parameters

Parameters of __construct()
NameTypeDescription
$backupDirstring

BackupCatalog::list()

public function list(): array

All backups in `$backupDir`, newest first (descending by `createdAt`).

BackupCatalog::prune()

public function prune(int $keep): array

Delete every backup beyond the newest `$keep` (by `createdAt`), removing its `.sql`/`.tar.gz`/`.manifest.json` files. `prune(0)` deletes everything.

Parameters

Parameters of prune()
NameTypeDescription
$keepint

Returns

the ids of the backups that were deleted