@@ 310-325 (lines=16) @@ | ||
307 | * @param \DOMElement $node |
|
308 | * @throws \phpbu\App\Exception |
|
309 | */ |
|
310 | protected function setCrypt(Configuration\Backup $backup, DOMElement $node) |
|
311 | { |
|
312 | /** @var \DOMNodeList $cryptNodes */ |
|
313 | $cryptNodes = $node->getElementsByTagName('crypt'); |
|
314 | if ($cryptNodes->length > 0) { |
|
315 | /** @var \DOMElement $cryptNode */ |
|
316 | $cryptNode = $cryptNodes->item(0); |
|
317 | $type = $cryptNode->getAttribute('type'); |
|
318 | if (!$type) { |
|
319 | throw new Exception('invalid crypt configuration: attribute type missing'); |
|
320 | } |
|
321 | $skip = Str::toBoolean($cryptNode->getAttribute('skipOnFailure'), true); |
|
322 | $options = $this->getOptions($cryptNode); |
|
323 | $backup->setCrypt(new Configuration\Backup\Crypt($type, $skip, $options)); |
|
324 | } |
|
325 | } |
|
326 | ||
327 | /** |
|
328 | * Set backup sync configurations. |
|
@@ 355-370 (lines=16) @@ | ||
352 | * @param \DOMElement $node |
|
353 | * @throws \phpbu\App\Exception |
|
354 | */ |
|
355 | protected function setCleanup(Configuration\Backup $backup, DOMElement $node) |
|
356 | { |
|
357 | /** @var \DOMNodeList $cleanupNodes */ |
|
358 | $cleanupNodes = $node->getElementsByTagName('cleanup'); |
|
359 | if ($cleanupNodes->length > 0) { |
|
360 | /** @var \DOMElement $cleanupNode */ |
|
361 | $cleanupNode = $cleanupNodes->item(0); |
|
362 | $type = $cleanupNode->getAttribute('type'); |
|
363 | if (!$type) { |
|
364 | throw new Exception('invalid cleanup configuration: attribute type missing'); |
|
365 | } |
|
366 | $skip = Str::toBoolean($cleanupNode->getAttribute('skipOnFailure'), true); |
|
367 | $options = $this->getOptions($cleanupNode); |
|
368 | $backup->setCleanup(new Configuration\Backup\Cleanup($type, $skip, $options)); |
|
369 | } |
|
370 | } |
|
371 | ||
372 | /** |
|
373 | * Extracts all option tags. |