objectManager = $objectManager; parent::__construct(); } /** * @inheritdoc */ protected function configure() { $description = 'Displays current application mode.'; $this->setName('deploy:mode:show')->setDescription($description); parent::configure(); } /** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { try { /** @var \Magento\Deploy\Model\Mode $mode */ $mode = $this->objectManager->create( \Magento\Deploy\Model\Mode::class, [ 'input' => $input, 'output' => $output, ] ); $currentMode = $mode->getMode() ?: State::MODE_DEFAULT; $output->writeln( "Current application mode: $currentMode. (Note: Environment variables may override this value.)" ); } catch (\Exception $e) { $output->writeln('' . $e->getMessage() . ''); if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { $output->writeln($e->getTraceAsString()); } return; } } }