4
4
* See COPYING.txt for license details.
5
5
*/
6
6
7
- namespace Magento \Setup \ Console ;
7
+ namespace Magento \Framework ;
8
8
9
9
use Symfony \Component \Console \Application as SymfonyApplication ;
10
10
use Magento \Framework \App \Bootstrap ;
11
11
use Magento \Framework \Shell \ComplexParameter ;
12
12
13
13
/**
14
- * Magento2 CLI Application
14
+ * Magento2 CLI Application. This is the hood for all command line tools supported by Magento.
15
15
*
16
16
* {@inheritdoc}
17
17
*/
18
- class Application extends SymfonyApplication
18
+ class Cli extends SymfonyApplication
19
19
{
20
20
/**
21
21
* {@inheritdoc}
@@ -37,8 +37,6 @@ protected function getDefaultCommands()
37
37
*/
38
38
protected function getApplicationCommands ()
39
39
{
40
- // TODO: this application class should be moved and probably refactored in scope of MAGETWO-35132
41
-
42
40
$ setupCommands = [];
43
41
$ toolsCommands = [];
44
42
$ modulesCommands = [];
@@ -47,10 +45,10 @@ protected function getApplicationCommands()
47
45
$ params = $ bootstrapParam ->mergeFromArgv ($ _SERVER , $ _SERVER );
48
46
$ params [Bootstrap::PARAM_REQUIRE_MAINTENANCE ] = null ;
49
47
$ bootstrap = Bootstrap::create (BP , $ params );
48
+ $ serviceManager = \Zend \Mvc \Application::init (require BP . '/setup/config/application.config.php ' )
49
+ ->getServiceManager ();
50
50
51
51
if (class_exists ('Magento\Setup\Console\CommandList ' )) {
52
- $ serviceManager = \Zend \Mvc \Application::init (require BP . '/setup/config/application.config.php ' )
53
- ->getServiceManager ();
54
52
$ setupCommandList = new \Magento \Setup \Console \CommandList ($ serviceManager );
55
53
$ setupCommands = $ setupCommandList ->getCommands ();
56
54
}
@@ -60,9 +58,7 @@ protected function getApplicationCommands()
60
58
$ toolsCommands = $ toolsCommandList ->getCommands ();
61
59
}
62
60
63
- // TODO: do we need to change this for better solution?
64
- if ($ bootstrap ->isInstalled ()) {
65
-
61
+ if ($ serviceManager ->get ('Magento\Framework\App\DeploymentConfig ' )->isAvailable ()) {
66
62
$ objectManager = $ bootstrap ->getObjectManager ();
67
63
$ commandList = $ objectManager ->create (
68
64
'Magento\Framework\Console\CommandList ' ,
0 commit comments