Skip to content

Commit

Permalink
MAGETWO-35132: Create console shell
Browse files Browse the repository at this point in the history
- moved Application class to framework
  • Loading branch information
eddielau committed Mar 19, 2015
1 parent 6aaee65 commit 42b8e55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bin/magento
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
try {
require __DIR__ . '/../app/bootstrap.php';
if (PHP_SAPI == 'cli') {
$application = new Magento\Setup\Console\Application('Magento CLI');
$application = new Magento\Framework\Cli('Magento CLI');
$application->run();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* See COPYING.txt for license details.
*/

namespace Magento\Setup\Console;
namespace Magento\Framework;

use Symfony\Component\Console\Application as SymfonyApplication;
use Magento\Framework\App\Bootstrap;
use Magento\Framework\Shell\ComplexParameter;

/**
* Magento2 CLI Application
* Magento2 CLI Application. This is the hood for all command line tools supported by Magento.
*
* {@inheritdoc}
*/
class Application extends SymfonyApplication
class Cli extends SymfonyApplication
{
/**
* {@inheritdoc}
Expand All @@ -37,8 +37,6 @@ protected function getDefaultCommands()
*/
protected function getApplicationCommands()
{
// TODO: this application class should be moved and probably refactored in scope of MAGETWO-35132

$setupCommands = [];
$toolsCommands = [];
$modulesCommands = [];
Expand All @@ -47,10 +45,10 @@ protected function getApplicationCommands()
$params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
$params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
$bootstrap = Bootstrap::create(BP, $params);
$serviceManager = \Zend\Mvc\Application::init(require BP . '/setup/config/application.config.php')
->getServiceManager();

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

// TODO: do we need to change this for better solution?
if ($bootstrap->isInstalled()) {

if ($serviceManager->get('Magento\Framework\App\DeploymentConfig')->isAvailable()) {
$objectManager = $bootstrap->getObjectManager();
$commandList = $objectManager->create(
'Magento\Framework\Console\CommandList',
Expand Down

0 comments on commit 42b8e55

Please sign in to comment.