@@ 29-60 (lines=32) @@ | ||
26 | * |
|
27 | * @package RunOpenCode\Backup\Workflow |
|
28 | */ |
|
29 | class Name extends BaseActivity implements LoggerAwareInterface, EventDispatcherAwareInterface |
|
30 | { |
|
31 | use LoggerAwareTrait; |
|
32 | use EventDispatcherAwareTrait; |
|
33 | ||
34 | /** |
|
35 | * {@inheritdoc} |
|
36 | */ |
|
37 | public function execute() |
|
38 | { |
|
39 | try { |
|
40 | ||
41 | $this->backup->setName($this->profile->getNamer()->getName()); |
|
42 | ||
43 | $this->getLogger()->info('Naming successfully completed.'); |
|
44 | $this->getEventDispatcher()->dispatch(BackupEvents::NAME, new BackupEvent($this, $this->profile, $this->backup, $this)); |
|
45 | ||
46 | ||
47 | } catch (\Exception $e) { |
|
48 | ||
49 | $this->getLogger()->error(sprintf('Could not set name of new backup for profile "%s".', $this->profile->getName()), array( |
|
50 | 'message' => $e->getMessage(), |
|
51 | 'code' => $e->getCode(), |
|
52 | 'file' => $e->getFile(), |
|
53 | 'line' => $e->getLine(), |
|
54 | 'trace' => $e->getTrace() |
|
55 | )); |
|
56 | ||
57 | throw $e; |
|
58 | } |
|
59 | } |
|
60 | } |
@@ 29-59 (lines=31) @@ | ||
26 | * |
|
27 | * @package RunOpenCode\Backup\Workflow |
|
28 | */ |
|
29 | class Push extends BaseActivity implements LoggerAwareInterface, EventDispatcherAwareInterface |
|
30 | { |
|
31 | use LoggerAwareTrait; |
|
32 | use EventDispatcherAwareTrait; |
|
33 | ||
34 | /** |
|
35 | * {@inheritdoc} |
|
36 | */ |
|
37 | public function execute() |
|
38 | { |
|
39 | try { |
|
40 | ||
41 | $this->profile->getDestination()->push($this->backup); |
|
42 | ||
43 | $this->getLogger()->info(sprintf('Backup "%s" successfully pushed to destination.', $this->backup->getName())); |
|
44 | $this->getEventDispatcher()->dispatch(BackupEvents::PUSH, new BackupEvent($this, $this->profile, $this->backup, $this)); |
|
45 | ||
46 | } catch (\Exception $e) { |
|
47 | ||
48 | $this->getLogger()->error(sprintf('Could not push backup to destination for profile "%s".', $this->profile->getName()), array( |
|
49 | 'message' => $e->getMessage(), |
|
50 | 'code' => $e->getCode(), |
|
51 | 'file' => $e->getFile(), |
|
52 | 'line' => $e->getLine(), |
|
53 | 'trace' => $e->getTrace() |
|
54 | )); |
|
55 | ||
56 | throw $e; |
|
57 | } |
|
58 | } |
|
59 | } |