Skip to content
docsv0.1.1

DatabaseDumperInterface

Contract for dumping the host's database to a single file. This package stays domain-blind and ships no implementation — the host provides the concrete dumper (e.g. shelling out to `mysqldump`, copying a SQLite file, etc). {@see BackupManager} (Task 7) orchestrates a dumper alongside {@see StorageArchiver} to build a backup.

DatabaseDumperInterface::dump()

abstract public function dump(string $destinationFile): void

Dump the database to `$destinationFile`. Implementations own how the dump is produced (shelling out, native driver, file copy) — this contract only fixes where the result lands.

Parameters

Parameters of dump()
NameTypeDescription
$destinationFilestring

DatabaseDumperInterface::extension()

abstract public function extension(): string

The file extension (without the leading dot) this dumper produces, e.g. `sql` for a `mysqldump` text dump or `sqlite` for a raw SQLite file copy. Callers use this to name the destination file before calling {@see self::dump()}.

DatabaseDumperInterface::restore()

abstract public function restore(string $sourceFile): void

Restore the database from `$sourceFile` (a file previously produced by {@see self::dump()}). Implementations own how the restore is performed (shelling out, native driver, file copy) — this contract only fixes where the source data comes from. {@see BackupManager::restore()} (Task 7) calls this after confirming the backup's manifest and files exist.

Parameters

Parameters of restore()
NameTypeDescription
$sourceFilestring