@@ 247-266 (lines=20) @@ | ||
244 | * @param \phpbu\App\Configuration\Backup $backup |
|
245 | * @param \phpbu\App\Backup\Target $target |
|
246 | */ |
|
247 | protected function executeCrypt(Configuration\Backup $backup, Target $target) |
|
248 | { |
|
249 | if ($backup->hasCrypt()) { |
|
250 | try { |
|
251 | $crypt = $backup->getCrypt(); |
|
252 | $this->result->cryptStart($crypt); |
|
253 | if ($this->failure && $crypt->skipOnFailure) { |
|
254 | $this->result->cryptSkipped($crypt); |
|
255 | } else { |
|
256 | /* @var \phpbu\App\Runner\Crypter $runner */ |
|
257 | $runner = $this->factory->createRunner('crypter', $this->configuration->isSimulation()); |
|
258 | $runner->run($this->factory->createCrypter($crypt->type, $crypt->options), $target, $this->result); |
|
259 | } |
|
260 | } catch (Backup\Crypter\Exception $e) { |
|
261 | $this->failure = true; |
|
262 | $this->result->addError($e); |
|
263 | $this->result->cryptFailed($crypt); |
|
264 | } |
|
265 | } |
|
266 | } |
|
267 | ||
268 | /** |
|
269 | * Execute all syncs. |
|
@@ 275-295 (lines=21) @@ | ||
272 | * @param \phpbu\App\Backup\Target $target |
|
273 | * @throws \Exception |
|
274 | */ |
|
275 | protected function executeSyncs(Configuration\Backup $backup, Target $target) |
|
276 | { |
|
277 | /* @var \phpbu\App\Runner\Crypter $runner */ |
|
278 | /* @var \phpbu\App\Configuration\Backup\Sync $sync */ |
|
279 | $runner = $this->factory->createRunner('sync', $this->configuration->isSimulation()); |
|
280 | foreach ($backup->getSyncs() as $sync) { |
|
281 | try { |
|
282 | $this->result->syncStart($sync); |
|
283 | if ($this->failure && $sync->skipOnFailure) { |
|
284 | $this->result->syncSkipped($sync); |
|
285 | } else { |
|
286 | $runner->run($this->factory->createSync($sync->type, $sync->options), $target, $this->result); |
|
287 | $this->result->syncEnd($sync); |
|
288 | } |
|
289 | } catch (Backup\Sync\Exception $e) { |
|
290 | $this->failure = true; |
|
291 | $this->result->addError($e); |
|
292 | $this->result->syncFailed($sync); |
|
293 | } |
|
294 | } |
|
295 | } |
|
296 | ||
297 | /** |
|
298 | * Execute the cleanup. |