/** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { $commandExecutor = new CommandExecutor($input->hasOption('env') ? $input->getOption('env') : null, $output, $this->getApplication(), $this->getContainer()->get('oro_cache.oro_data_cache_manager')); $scriptExecutor = new ScriptExecutor($output, $this->getContainer(), $commandExecutor); $scriptFiles = $input->getArgument('script'); foreach ($scriptFiles as $scriptFile) { $scriptExecutor->runScript($scriptFile); } }
public function testRunScript() { $testScriptFile = realpath(__DIR__ . '/Fixture/src/TestPackage/install.php'); $output = $this->getMockBuilder('Symfony\\Component\\Console\\Output\\StreamOutput')->disableOriginalConstructor()->getMock(); $output->expects($this->at(0))->method('writeln')->with($this->stringContains(sprintf('Launching "Test Package Installer" (%s) script', $testScriptFile))); $output->expects($this->at(1))->method('writeln')->with('Test Package Installer data'); $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder'); $commandExecutor = $this->getMockBuilder('Oro\\Bundle\\InstallerBundle\\CommandExecutor')->disableOriginalConstructor()->getMock(); $scriptExecutor = new ScriptExecutor($output, $container, $commandExecutor); $scriptExecutor->runScript($testScriptFile); }
public function displayAction(ProcessContextInterface $context) { set_time_limit(900); $action = $this->getRequest()->query->get('action'); switch ($action) { case 'fixtures': return $this->handleAjaxAction('oro:migration:data:load', array('--fixtures-type' => 'demo', '--disabled-listeners' => array('oro_dataaudit.listener.entity_listener', 'oro_dataaudit.listener.deprecated_audit_data_listener'))); case 'navigation': return $this->handleAjaxAction('oro:navigation:init'); case 'js-routing': return $this->handleAjaxAction('fos:js-routing:dump'); case 'localization': return $this->handleAjaxAction('oro:localization:dump'); case 'assets': return $this->handleAjaxAction('oro:assets:install', array('target' => './', '--exclude' => ['OroInstallerBundle'])); case 'assetic': return $this->handleAjaxAction('assetic:dump'); case 'translation': return $this->handleAjaxAction('oro:translation:dump'); case 'requirejs': return $this->handleAjaxAction('oro:requirejs:build', array('--ignore-errors' => true)); case 'finish': $this->get('event_dispatcher')->dispatch(InstallerEvents::FINISH); // everything was fine - update installed flag in parameters.yml $dumper = $this->get('oro_installer.yaml_persister'); $params = $dumper->parse(); $params['system']['installed'] = date('c'); $dumper->dump($params); // launch 'cache:clear' to set installed flag in DI container // suppress warning: ini_set(): A session is active. You cannot change the session // module's ini settings at this time error_reporting(E_ALL ^ E_WARNING); return $this->handleAjaxAction('cache:clear'); } // check if we have package installation step if (strpos($action, 'installerScript-') !== false) { $scriptFile = $this->container->get('oro_installer.script_manager')->getScriptFileByKey(str_replace('installerScript-', '', $action)); $scriptExecutor = new ScriptExecutor($this->getOutput(), $this->container, new CommandExecutor($this->container->getParameter('kernel.environment'), $this->getOutput(), $this->getApplication())); $scriptExecutor->runScript($scriptFile); return new JsonResponse(array('result' => true)); } return $this->render('OroInstallerBundle:Process/Step:installation.html.twig', array('loadFixtures' => $context->getStorage()->get('loadFixtures'), 'installerScripts' => $this->container->get('oro_installer.script_manager')->getScriptLabels())); }
/** * Process installer scripts * * @param OutputInterface $output * @param CommandExecutor $commandExecutor */ protected function processInstallerScripts(OutputInterface $output, CommandExecutor $commandExecutor) { $scriptExecutor = new ScriptExecutor($output, $this->getContainer(), $commandExecutor); /** @var ScriptManager $scriptManager */ $scriptManager = $this->getContainer()->get('oro_installer.script_manager'); $scriptFiles = $scriptManager->getScriptFiles(); if (!empty($scriptFiles)) { foreach ($scriptFiles as $scriptFile) { $scriptExecutor->runScript($scriptFile); } } }