Skip to content

Commit 42b8e55

Browse files
committed
MAGETWO-35132: Create console shell
- moved Application class to framework
1 parent 6aaee65 commit 42b8e55

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

bin/magento

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
try {
99
require __DIR__ . '/../app/bootstrap.php';
1010
if (PHP_SAPI == 'cli') {
11-
$application = new Magento\Setup\Console\Application('Magento CLI');
11+
$application = new Magento\Framework\Cli('Magento CLI');
1212
$application->run();
1313
}
1414

setup/src/Magento/Setup/Console/Application.php renamed to lib/internal/Magento/Framework/Cli.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
namespace Magento\Setup\Console;
7+
namespace Magento\Framework;
88

99
use Symfony\Component\Console\Application as SymfonyApplication;
1010
use Magento\Framework\App\Bootstrap;
1111
use Magento\Framework\Shell\ComplexParameter;
1212

1313
/**
14-
* Magento2 CLI Application
14+
* Magento2 CLI Application. This is the hood for all command line tools supported by Magento.
1515
*
1616
* {@inheritdoc}
1717
*/
18-
class Application extends SymfonyApplication
18+
class Cli extends SymfonyApplication
1919
{
2020
/**
2121
* {@inheritdoc}
@@ -37,8 +37,6 @@ protected function getDefaultCommands()
3737
*/
3838
protected function getApplicationCommands()
3939
{
40-
// TODO: this application class should be moved and probably refactored in scope of MAGETWO-35132
41-
4240
$setupCommands = [];
4341
$toolsCommands = [];
4442
$modulesCommands = [];
@@ -47,10 +45,10 @@ protected function getApplicationCommands()
4745
$params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
4846
$params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
4947
$bootstrap = Bootstrap::create(BP, $params);
48+
$serviceManager = \Zend\Mvc\Application::init(require BP . '/setup/config/application.config.php')
49+
->getServiceManager();
5050

5151
if (class_exists('Magento\Setup\Console\CommandList')) {
52-
$serviceManager = \Zend\Mvc\Application::init(require BP . '/setup/config/application.config.php')
53-
->getServiceManager();
5452
$setupCommandList = new \Magento\Setup\Console\CommandList($serviceManager);
5553
$setupCommands = $setupCommandList->getCommands();
5654
}
@@ -60,9 +58,7 @@ protected function getApplicationCommands()
6058
$toolsCommands = $toolsCommandList->getCommands();
6159
}
6260

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()) {
6662
$objectManager = $bootstrap->getObjectManager();
6763
$commandList = $objectManager->create(
6864
'Magento\Framework\Console\CommandList',

0 commit comments

Comments
 (0)