| @@ 226-245 (lines=20) @@ | ||
| 223 | * @param \phpbu\App\Configuration\Backup $backup |
|
| 224 | * @param \phpbu\App\Backup\Target $target |
|
| 225 | */ |
|
| 226 | protected function executeCrypt(Configuration\Backup $backup, Target $target) |
|
| 227 | { |
|
| 228 | $crypt = $backup->getCrypt(); |
|
| 229 | if (!empty($crypt)) { |
|
| 230 | try { |
|
| 231 | $this->result->cryptStart($crypt); |
|
| 232 | if ($this->failure && $crypt->skipOnFailure) { |
|
| 233 | $this->result->cryptSkipped($crypt); |
|
| 234 | } else { |
|
| 235 | $c = $this->factory->createCrypter($crypt->type, $crypt->options); |
|
| 236 | $c->crypt($target, $this->result); |
|
| 237 | $target->setCrypter($c); |
|
| 238 | } |
|
| 239 | } catch (Backup\Crypter\Exception $e) { |
|
| 240 | $this->failure = true; |
|
| 241 | $this->result->addError($e); |
|
| 242 | $this->result->cryptFailed($crypt); |
|
| 243 | } |
|
| 244 | } |
|
| 245 | } |
|
| 246 | ||
| 247 | /** |
|
| 248 | * Execute the syncs. |
|
| @@ 283-302 (lines=20) @@ | ||
| 280 | * @param \phpbu\App\Backup\Collector $collector |
|
| 281 | * @throws \Exception |
|
| 282 | */ |
|
| 283 | protected function executeCleanup(Configuration\Backup $backup, Target $target, Collector $collector) |
|
| 284 | { |
|
| 285 | $cleanup = $backup->getCleanup(); |
|
| 286 | if (!empty($cleanup)) { |
|
| 287 | try { |
|
| 288 | $this->result->cleanupStart($cleanup); |
|
| 289 | if ($this->failure && $cleanup->skipOnFailure) { |
|
| 290 | $this->result->cleanupSkipped($cleanup); |
|
| 291 | } else { |
|
| 292 | $cleaner = $this->factory->createCleaner($cleanup->type, $cleanup->options); |
|
| 293 | $cleaner->cleanup($target, $collector, $this->result); |
|
| 294 | $this->result->cleanupEnd($cleanup); |
|
| 295 | } |
|
| 296 | } catch (Backup\Cleaner\Exception $e) { |
|
| 297 | $this->failure = true; |
|
| 298 | $this->result->addError($e); |
|
| 299 | $this->result->cleanupFailed($cleanup); |
|
| 300 | } |
|
| 301 | } |
|
| 302 | } |
|
| 303 | } |
|
| 304 | ||