| @@ 102-117 (lines=16) @@ | ||
| 99 | * @return \phpbu\App\Backup\Source\Status |
|
| 100 | * @throws \phpbu\App\Exception |
|
| 101 | */ |
|
| 102 | public function backup(Target $target, Result $result) : Status |
|
| 103 | { |
|
| 104 | // make sure source path is a directory |
|
| 105 | $this->validatePath(); |
|
| 106 | // set uncompressed default MIME type |
|
| 107 | $target->setMimeType('application/x-tar'); |
|
| 108 | $tar = $this->execute($target); |
|
| 109 | ||
| 110 | $result->debug($tar->getCmdPrintable()); |
|
| 111 | ||
| 112 | if ($this->tarFailed($tar)) { |
|
| 113 | throw new Exception('tar failed: ' . $tar->getStdErr()); |
|
| 114 | } |
|
| 115 | ||
| 116 | return $this->createStatus($target); |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * Check if tar failed. |
|
| @@ 119-130 (lines=12) @@ | ||
| 116 | * @return \phpbu\App\Backup\Source\Status |
|
| 117 | * @throws \phpbu\App\Exception |
|
| 118 | */ |
|
| 119 | public function backup(Target $target, Result $result) : Status |
|
| 120 | { |
|
| 121 | $innobackupex = $this->execute($target); |
|
| 122 | ||
| 123 | $result->debug($this->getExecutable($target)->getCommandPrintable()); |
|
| 124 | ||
| 125 | if (!$innobackupex->isSuccessful()) { |
|
| 126 | throw new Exception('XtraBackup failed: ' . $innobackupex->getStdErr()); |
|
| 127 | } |
|
| 128 | ||
| 129 | return $this->createStatus($target); |
|
| 130 | } |
|
| 131 | ||
| 132 | /** |
|
| 133 | * Create the Executable to run the innobackupex backup and apply-log commands. |
|