7
7
8
8
namespace Magento \MagentoCloud \Command ;
9
9
10
+ use Magento \MagentoCloud \Cli ;
10
11
use Symfony \Component \Console \Command \Command ;
11
12
use Magento \MagentoCloud \Command \Backup \Restore ;
12
13
use Symfony \Component \Console \Input \InputInterface ;
13
14
use Symfony \Component \Console \Output \OutputInterface ;
14
15
use Symfony \Component \Console \Input \InputOption ;
15
16
use Symfony \Component \Console \Question \ConfirmationQuestion ;
16
17
use Psr \Log \LoggerInterface ;
18
+ use Exception ;
17
19
18
20
/**
19
21
* CLI command for restoring Magento configuration files from backup.
@@ -32,10 +34,7 @@ class BackupRestore extends Command
32
34
*/
33
35
private $ logger ;
34
36
35
- /**
36
- * Command name
37
- */
38
- const NAME = 'backup:restore ' ;
37
+ public const NAME = 'backup:restore ' ;
39
38
40
39
/**
41
40
* @param Restore $restore
@@ -45,13 +44,14 @@ public function __construct(Restore $restore, LoggerInterface $logger)
45
44
{
46
45
$ this ->restore = $ restore ;
47
46
$ this ->logger = $ logger ;
47
+
48
48
parent ::__construct ();
49
49
}
50
50
51
51
/**
52
52
* @inheritdoc
53
53
*/
54
- protected function configure ()
54
+ protected function configure (): void
55
55
{
56
56
$ this ->setName (self ::NAME )
57
57
->setDescription (
@@ -74,9 +74,11 @@ protected function configure()
74
74
}
75
75
76
76
/**
77
- * @inheritdoc
77
+ * {@inheritdoc}
78
+ *
79
+ * @throws Exception
78
80
*/
79
- protected function execute (InputInterface $ input , OutputInterface $ output )
81
+ protected function execute (InputInterface $ input , OutputInterface $ output ): int
80
82
{
81
83
try {
82
84
$ restore = true ;
@@ -93,9 +95,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
93
95
if ($ restore ) {
94
96
$ this ->restore ->run ($ input , $ output );
95
97
}
96
- } catch (\ Exception $ exception ) {
98
+ } catch (Exception $ exception ) {
97
99
$ this ->logger ->critical ($ exception ->getMessage ());
100
+
98
101
throw $ exception ;
99
102
}
103
+
104
+ return Cli::SUCCESS ;
100
105
}
101
106
}
0 commit comments