Exemple #1
0
 /**
  * Run application
  *
  * @return ResponseInterface
  */
 public function launch()
 {
     $this->_state->setAreaCode('crontab');
     $this->_eventManager->dispatch('default');
     $this->_response->setCode(0);
     return $this->_response;
 }
 /**
  * Run application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     $shell = $this->_shellFactory->create(['entryPoint' => $this->_entryFileName]);
     $shell->run();
     $this->_response->setCode(0);
     return $this->_response;
 }
Exemple #3
0
 /**
  * @dataProvider setCodeProvider
  */
 public function testSetCode($code, $expectedCode)
 {
     $this->model->terminateOnSend(false);
     $this->model->setCode($code);
     $result = $this->model->sendResponse();
     $this->assertEquals($expectedCode, $result);
 }
Exemple #4
0
 /**
  * Run application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     /** @var $shell \Magento\Log\Model\Shell */
     $shell = $this->_shellFactory->create(['entryPoint' => $this->_entryFileName]);
     $shell->run();
     $this->_response->setCode(0);
     return $this->_response;
 }
Exemple #5
0
 /**
  * Run application
  *
  * @return ResponseInterface
  */
 public function launch()
 {
     $this->_state->setAreaCode(Area::AREA_CRONTAB);
     $configLoader = $this->objectManager->get('Magento\\Framework\\ObjectManager\\ConfigLoaderInterface');
     $this->objectManager->configure($configLoader->load(Area::AREA_CRONTAB));
     /** @var \Magento\Framework\Event\ManagerInterface $eventManager */
     $eventManager = $this->objectManager->get('Magento\\Framework\\Event\\ManagerInterface');
     $eventManager->dispatch('default');
     $this->_response->setCode(0);
     return $this->_response;
 }
Exemple #6
0
 /**
  * Run application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     /** @var $shell \Magento\Indexer\Model\Shell */
     $shell = $this->shellFactory->create(array('entryPoint' => $this->entryFileName));
     $shell->run();
     if ($shell->hasErrors()) {
         $this->response->setCode(-1);
     } else {
         $this->response->setCode(0);
     }
     return $this->response;
 }
Exemple #7
0
 /**
  * Run application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     /* Clean reports */
     $directory = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT);
     $path = $directory->getRelativePath($this->reportDir);
     if ($directory->isExist($path)) {
         $directory->delete($path);
     }
     /* Regenerate all indexers */
     $this->processor->reindexAll();
     $this->_response->setCode(0);
     return $this->_response;
 }
Exemple #8
0
 /**
  * Run application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     $areaCode = 'install';
     $this->_state->setAreaCode($areaCode);
     $this->_objectManager->configure($this->_loader->load($areaCode));
     if (isset($this->_arguments['uninstall'])) {
         $sessionConsole = $this->_objectManager->create('\\Magento\\Framework\\Session\\SessionConsole');
         $installerModel = $this->_objectManager->create('Magento\\Install\\Model\\Installer', ['session' => $sessionConsole]);
         $installer = $this->_installerFactory->create(['installArgs' => $this->_arguments, 'installer' => $installerModel]);
     } else {
         $installer = $this->_installerFactory->create(array('installArgs' => $this->_arguments));
     }
     if (isset($this->_arguments['show_locales'])) {
         $this->_output->readableOutput($this->_output->prepareArray($installer->getAvailableLocales()));
     } elseif (isset($this->_arguments['show_currencies'])) {
         $this->_output->readableOutput($this->_output->prepareArray($installer->getAvailableCurrencies()));
     } elseif (isset($this->_arguments['show_timezones'])) {
         $this->_output->readableOutput($this->_output->prepareArray($installer->getAvailableTimezones()));
     } elseif (isset($this->_arguments['show_install_options'])) {
         $this->_output->readableOutput(PHP_EOL . 'Required parameters:');
         $this->_output->readableOutput($this->_output->alignArrayKeys($installer->getRequiredParams()));
         $this->_output->readableOutput(PHP_EOL . 'Optional parameters:');
         $this->_output->readableOutput($this->_output->alignArrayKeys($installer->getOptionalParams()));
         $this->_output->readableOutput(PHP_EOL . 'Flag values are considered positive if set to 1, y, true or yes.' . 'Any other value is considered as negative.' . PHP_EOL);
     } else {
         $this->_handleInstall($installer);
     }
     $this->_response->setCode(0);
     return $this->_response;
 }
 /**
  * Launch application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     $this->objectManager->configure(['preferences' => ['Magento\\Tools\\Di\\Compiler\\Config\\WriterInterface' => 'Magento\\Tools\\Di\\Compiler\\Config\\Writer\\Filesystem', 'Magento\\Tools\\Di\\Compiler\\Log\\Writer\\WriterInterface' => 'Magento\\Tools\\Di\\Compiler\\Log\\Writer\\Console'], 'Magento\\Tools\\Di\\Compiler\\Config\\ModificationChain' => ['arguments' => ['modificationsList' => ['BackslashTrim' => ['instance' => 'Magento\\Tools\\Di\\Compiler\\Config\\Chain\\BackslashTrim'], 'PreferencesResolving' => ['instance' => 'Magento\\Tools\\Di\\Compiler\\Config\\Chain\\PreferencesResolving'], 'InterceptorSubstitution' => ['instance' => 'Magento\\Tools\\Di\\Compiler\\Config\\Chain\\InterceptorSubstitution'], 'InterceptionPreferencesResolving' => ['instance' => 'Magento\\Tools\\Di\\Compiler\\Config\\Chain\\PreferencesResolving'], 'ArgumentsSerialization' => ['instance' => 'Magento\\Tools\\Di\\Compiler\\Config\\Chain\\ArgumentsSerialization']]]], 'Magento\\Tools\\Di\\Code\\Generator\\PluginList' => ['arguments' => ['cache' => ['instance' => 'Magento\\Framework\\App\\Interception\\Cache\\CompiledConfig']]], 'Magento\\Tools\\Di\\Code\\Reader\\ClassesScanner' => ['arguments' => ['excludePatterns' => $this->excludedPathsList]]]);
     $operations = [Task\OperationFactory::REPOSITORY_GENERATOR => ['path' => $this->compiledPathsList['application'], 'filePatterns' => ['di' => '/\\/etc\\/([a-zA-Z_]*\\/di|di)\\.xml$/']], Task\OperationFactory::APPLICATION_CODE_GENERATOR => [$this->compiledPathsList['application'], $this->compiledPathsList['library'], $this->compiledPathsList['generated_helpers']], Task\OperationFactory::INTERCEPTION => ['intercepted_paths' => [$this->compiledPathsList['application'], $this->compiledPathsList['library'], $this->compiledPathsList['generated_helpers']], 'path_to_store' => $this->compiledPathsList['generated_helpers']], Task\OperationFactory::AREA_CONFIG_GENERATOR => [$this->compiledPathsList['application'], $this->compiledPathsList['library'], $this->compiledPathsList['generated_helpers']], Task\OperationFactory::INTERCEPTION_CACHE => [$this->compiledPathsList['application'], $this->compiledPathsList['library'], $this->compiledPathsList['generated_helpers']]];
     $responseCode = Response::SUCCESS;
     try {
         foreach ($operations as $operationCode => $arguments) {
             $this->taskManager->addOperation($operationCode, $arguments);
         }
         $this->taskManager->process();
     } catch (Task\OperationException $e) {
         $responseCode = Response::ERROR;
         $this->response->setBody($e->getMessage());
     }
     $this->response->setCode($responseCode);
     return $this->response;
 }
Exemple #10
0
 /**
  * Launch application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     $this->objectManager->configure(['preferences' => ['Magento\\Tools\\Di\\Compiler\\Config\\WriterInterface' => 'Magento\\Tools\\Di\\Compiler\\Config\\Writer\\Filesystem']]);
     $operations = [Task\OperationFactory::AREA => [BP . '/' . 'app/code', BP . '/' . 'lib/internal/Magento/Framework', BP . '/' . 'var/generation'], Task\OperationFactory::INTERCEPTION => BP . '/var/generation', Task\OperationFactory::INTERCEPTION_CACHE => [BP . '/' . 'app/code', BP . '/' . 'lib/internal/Magento/Framework', BP . '/' . 'var/generation']];
     $responseCode = Response::SUCCESS;
     try {
         foreach ($operations as $operationCode => $arguments) {
             $this->taskManager->addOperation($operationCode, $arguments);
         }
         $this->taskManager->process();
     } catch (Task\OperationException $e) {
         $responseCode = Response::ERROR;
         $this->response->setBody($e->getMessage());
     }
     $this->response->setCode($responseCode);
     return $this->response;
 }
Exemple #11
0
 /**
  * Run application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     /* Clean reports */
     $directory = $this->_filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem::ROOT_DIR);
     $path = $directory->getRelativePath($this->_reportDir);
     if ($directory->isExist($path)) {
         $directory->delete($path);
     }
     /* Run all indexer processes */
     /** @var $indexer \Magento\Index\Model\Indexer */
     $indexer = $this->_indexerFactory->create();
     /** @var $process \Magento\Index\Model\Process */
     foreach ($indexer->getProcessesCollection() as $process) {
         if ($process->getIndexer()->isVisible()) {
             $process->reindexEverything();
         }
     }
     $this->_response->setCode(0);
     return $this->_response;
 }
 /**
  * Launch application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     $this->state->setAreaCode($this->params->getArea());
     $this->objectManager->configure($this->configLoader->load($this->params->getArea()));
     $sourceFileGenerator = $this->sourceFileGeneratorPool->create($this->params->getExt());
     foreach ($this->params->getFiles() as $file) {
         $file .= '.' . $this->params->getExt();
         $this->logger->logMessage("Gathering {$file} sources.");
         $asset = $this->assetRepo->createAsset($file, ['area' => $this->params->getArea(), 'theme' => $this->params->getTheme(), 'locale' => $this->params->getLocale()]);
         $sourceFile = $this->assetSource->findSource($asset);
         $content = \file_get_contents($sourceFile);
         $chain = $this->chainFactory->create(['asset' => $asset, 'origContent' => $content, 'origContentType' => $asset->getContentType()]);
         $processedCoreFile = $sourceFileGenerator->generateFileTree($chain);
         $targetDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
         $rootDir = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT);
         $source = $rootDir->getRelativePath($processedCoreFile);
         $destination = $asset->getPath();
         $rootDir->copyFile($source, $destination, $targetDir);
         $this->logger->logMessage("Done");
     }
     $this->response->setCode(Response::SUCCESS);
     return $this->response;
 }