| @@ 17-30 (lines=14) @@ | ||
| 14 | * |
|
| 15 | * @throws \Spatie\DbDumper\Exceptions\DumpFailed |
|
| 16 | */ |
|
| 17 | public function dumpToFile(string $dumpFile) |
|
| 18 | { |
|
| 19 | $command = $this->getDumpCommand($dumpFile); |
|
| 20 | ||
| 21 | $process = new Process($command); |
|
| 22 | ||
| 23 | if (! is_null($this->timeout)) { |
|
| 24 | $process->setTimeout($this->timeout); |
|
| 25 | } |
|
| 26 | ||
| 27 | $process->run(); |
|
| 28 | ||
| 29 | $this->checkIfDumpWasSuccessFul($process, $dumpFile); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Get the command that should be performed to dump the database. |
|
| @@ 30-45 (lines=16) @@ | ||
| 27 | * @throws \Spatie\DbDumper\Exceptions\CannotStartDump |
|
| 28 | * @throws \Spatie\DbDumper\Exceptions\DumpFailed |
|
| 29 | */ |
|
| 30 | public function dumpToFile(string $dumpFile) |
|
| 31 | { |
|
| 32 | $this->guardAgainstIncompleteCredentials(); |
|
| 33 | ||
| 34 | $command = $this->getDumpCommand($dumpFile); |
|
| 35 | ||
| 36 | $process = new Process($command); |
|
| 37 | ||
| 38 | if (! is_null($this->timeout)) { |
|
| 39 | $process->setTimeout($this->timeout); |
|
| 40 | } |
|
| 41 | ||
| 42 | $process->run(); |
|
| 43 | ||
| 44 | $this->checkIfDumpWasSuccessFul($process, $dumpFile); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Verifies if the dbname and host options are set. |
|