Exemplo n.º 1
1
 /**
  * Gets application commands
  *
  * @return array
  */
 protected function getApplicationCommands()
 {
     $commands = [];
     try {
         $bootstrapParam = new ComplexParameter(self::INPUT_KEY_BOOTSTRAP);
         $params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
         $params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
         $bootstrap = Bootstrap::create(BP, $params);
         $objectManager = $bootstrap->getObjectManager();
         /** @var \Magento\Setup\Model\ObjectManagerProvider $omProvider */
         $omProvider = $this->serviceManager->get('Magento\\Setup\\Model\\ObjectManagerProvider');
         $omProvider->setObjectManager($objectManager);
         if (class_exists('Magento\\Setup\\Console\\CommandList')) {
             $setupCommandList = new \Magento\Setup\Console\CommandList($this->serviceManager);
             $commands = array_merge($commands, $setupCommandList->getCommands());
         }
         if ($objectManager->get('Magento\\Framework\\App\\DeploymentConfig')->isAvailable()) {
             /** @var \Magento\Framework\Console\CommandList $commandList */
             $commandList = $objectManager->create('Magento\\Framework\\Console\\CommandList');
             $commands = array_merge($commands, $commandList->getCommands());
         }
         $commands = array_merge($commands, $this->getVendorCommands($objectManager));
     } catch (\Exception $e) {
         $this->initException = $e;
     }
     return $commands;
 }
Exemplo n.º 2
1
 /**
  * Gets application commands
  *
  * @return array
  */
 protected function getApplicationCommands()
 {
     $setupCommands = [];
     $toolsCommands = [];
     $modulesCommands = [];
     $bootstrapParam = new ComplexParameter(self::INPUT_KEY_BOOTSTRAP);
     $params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
     $params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
     $bootstrap = Bootstrap::create(BP, $params);
     $objectManager = $bootstrap->getObjectManager();
     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();
     }
     if (class_exists('Magento\\Tools\\Console\\CommandList')) {
         $toolsCommandList = new \Magento\Tools\Console\CommandList();
         $toolsCommands = $toolsCommandList->getCommands();
     }
     if ($objectManager->get('Magento\\Framework\\App\\DeploymentConfig')->isAvailable()) {
         $commandList = $objectManager->create('Magento\\Framework\\Console\\CommandList');
         $modulesCommands = $commandList->getCommands();
     }
     $commandsList = array_merge($setupCommands, $toolsCommands, $modulesCommands);
     return $commandsList;
 }
 public function testMergeFromArgv()
 {
     $object = new ComplexParameter('foo');
     $server = ['argv' => ['--foo=bar=value1', '--nonfoo=value2']];
     $into = ['baz' => 'value3'];
     $this->assertSame(['baz' => 'value3', 'bar' => 'value1'], $object->mergeFromArgv($server, $into));
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $params[self::INPUT_KEY_GROUP] = $input->getOption(self::INPUT_KEY_GROUP);
     $params[Observer::STANDALONE_PROCESS_STARTED] = '0';
     $bootstrap = $input->getOption(Cli::INPUT_KEY_BOOTSTRAP);
     if ($bootstrap) {
         $bootstrapProcessor = new ComplexParameter(Cli::INPUT_KEY_BOOTSTRAP);
         $bootstrapOptionValues = $bootstrapProcessor->getFromString('--' . Cli::INPUT_KEY_BOOTSTRAP . '=' . $bootstrap);
         $bootstrapOptionValue = $bootstrapOptionValues[Observer::STANDALONE_PROCESS_STARTED];
         if ($bootstrapOptionValue) {
             $params[Observer::STANDALONE_PROCESS_STARTED] = $bootstrapOptionValue;
         }
     }
     /** @var \Magento\Framework\App\Cron $cronObserver */
     $cronObserver = $this->objectManager->create('Magento\\Framework\\App\\Cron', ['parameters' => $params]);
     $cronObserver->launch();
     $output->writeln('<info>' . 'Ran jobs by schedule.' . '</info>');
 }
Exemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $omParams = $_SERVER;
     $omParams[StoreManager::PARAM_RUN_CODE] = 'admin';
     $omParams[Store::CUSTOM_ENTRY_POINT_PARAM] = true;
     $objectManager = $this->objectManagerFactory->create($omParams);
     $params[self::INPUT_KEY_GROUP] = $input->getOption(self::INPUT_KEY_GROUP);
     $params[ProcessCronQueueObserver::STANDALONE_PROCESS_STARTED] = '0';
     $bootstrap = $input->getOption(Cli::INPUT_KEY_BOOTSTRAP);
     if ($bootstrap) {
         $bootstrapProcessor = new ComplexParameter(Cli::INPUT_KEY_BOOTSTRAP);
         $bootstrapOptionValues = $bootstrapProcessor->getFromString('--' . Cli::INPUT_KEY_BOOTSTRAP . '=' . $bootstrap);
         $bootstrapOptionValue = $bootstrapOptionValues[ProcessCronQueueObserver::STANDALONE_PROCESS_STARTED];
         if ($bootstrapOptionValue) {
             $params[ProcessCronQueueObserver::STANDALONE_PROCESS_STARTED] = $bootstrapOptionValue;
         }
     }
     /** @var \Magento\Framework\App\Cron $cronObserver */
     $cronObserver = $objectManager->create('Magento\\Framework\\App\\Cron', ['parameters' => $params]);
     $cronObserver->launch();
     $output->writeln('<info>' . 'Ran jobs by schedule.' . '</info>');
 }
Exemplo n.º 6
0
 /**
  * Extracts the directory paths from a CLI request
  *
  * Uses format of a URL query
  *
  * @param RequestInterface $request
  * @return array
  */
 private function extractFromCli(RequestInterface $request)
 {
     if (!($request instanceof Request)) {
         return [];
     }
     $bootstrapParam = new ComplexParameter(self::BOOTSTRAP_PARAM);
     foreach ($request->getContent() as $paramStr) {
         $result = $bootstrapParam->getFromString($paramStr);
         if (!empty($result)) {
             return $result;
         }
     }
     return [];
 }
Exemplo n.º 7
0
<?php

/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
use Magento\Framework\App\Bootstrap;
use Magento\Framework\App\State;
use Magento\Framework\Shell\ComplexParameter;
require_once __DIR__ . '/../../../../../app/bootstrap.php';
$usage = 'Usage: php -f install.php -- --admin_username= [--bootstrap=]
    --admin_username - store\'s admin username. Required for installation.
    [--bootstrap] - add or override parameters of the bootstrap' . PHP_EOL;
$data = getopt('', ['admin_username:', 'bootstrap::']);
if (!isset($data['admin_username']) || empty($data['admin_username'])) {
    echo $usage;
    exit(1);
}
$bootstrapParam = new ComplexParameter('bootstrap');
$params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
$params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
$params[State::PARAM_MODE] = State::MODE_DEVELOPER;
$bootstrap = Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\\Tools\\SampleData\\InstallerApp', ['data' => $data]);
$bootstrap->run($app);