@@ 284-299 (lines=16) @@ | ||
281 | * @param \DOMElement $node |
|
282 | * @throws \phpbu\App\Exception |
|
283 | */ |
|
284 | protected function setCrypt(Configuration\Backup $backup, DOMElement $node) |
|
285 | { |
|
286 | /** @var \DOMNodeList $cryptNodes */ |
|
287 | $cryptNodes = $node->getElementsByTagName('crypt'); |
|
288 | if ($cryptNodes->length > 0) { |
|
289 | /** @var \DOMElement $cryptNode */ |
|
290 | $cryptNode = $cryptNodes->item(0); |
|
291 | $type = $cryptNode->getAttribute('type'); |
|
292 | if (!$type) { |
|
293 | throw new Exception('invalid crypt configuration: attribute type missing'); |
|
294 | } |
|
295 | $skip = Str::toBoolean($cryptNode->getAttribute('skipOnFailure'), true); |
|
296 | $options = $this->getOptions($cryptNode); |
|
297 | $backup->setCrypt(new Configuration\Backup\Crypt($type, $skip, $options)); |
|
298 | } |
|
299 | } |
|
300 | ||
301 | /** |
|
302 | * Set backup sync configurations. |
|
@@ 329-344 (lines=16) @@ | ||
326 | * @param \DOMElement $node |
|
327 | * @throws \phpbu\App\Exception |
|
328 | */ |
|
329 | protected function setCleanup(Configuration\Backup $backup, DOMElement $node) |
|
330 | { |
|
331 | /** @var \DOMNodeList $cleanupNodes */ |
|
332 | $cleanupNodes = $node->getElementsByTagName('cleanup'); |
|
333 | if ($cleanupNodes->length > 0) { |
|
334 | /** @var \DOMElement $cleanupNode */ |
|
335 | $cleanupNode = $cleanupNodes->item(0); |
|
336 | $type = $cleanupNode->getAttribute('type'); |
|
337 | if (!$type) { |
|
338 | throw new Exception('invalid cleanup configuration: attribute type missing'); |
|
339 | } |
|
340 | $skip = Str::toBoolean($cleanupNode->getAttribute('skipOnFailure'), true); |
|
341 | $options = $this->getOptions($cleanupNode); |
|
342 | $backup->setCleanup(new Configuration\Backup\Cleanup($type, $skip, $options)); |
|
343 | } |
|
344 | } |
|
345 | ||
346 | /** |
|
347 | * Extracts all option tags. |