コード例 #1
0
 /**
  * Constructor.
  *
  * @param GitRepository $repository The git repository to work on.
  */
 public function __construct(GitRepository $repository)
 {
     $this->repository = $repository;
     $this->processBuilder = new ProcessBuilder();
     $this->processBuilder->setWorkingDirectory($repository->getRepositoryPath());
     $this->processBuilder->add($this->repository->getConfig()->getGitExecutablePath());
     $this->initializeProcessBuilder();
 }
コード例 #2
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     echo "Run task: #" . $this->job_id, "\n";
     $task = Tasks::find($this->job_id);
     $task->status = Tasks::RUN;
     $task->save();
     $client = new \Hoa\Websocket\Client(new \Hoa\Socket\Client('tcp://127.0.0.1:8889'));
     $client->setHost('127.0.0.1');
     $client->connect();
     $client->send(json_encode(["command" => webSocket::BROADCASTIF, "jobid" => $this->job_id, "msg" => json_encode(["jid" => $this->job_id, "status" => Tasks::RUN])]));
     $builder = new ProcessBuilder();
     $builder->setPrefix('ansible-playbook');
     $builder->setArguments(["-i", "inv" . $this->job_id, "yml" . $this->job_id]);
     $builder->setWorkingDirectory(storage_path("roles"));
     $process = $builder->getProcess();
     $process->run();
     //echo $process->getOutput() . "\n";
     $client->send(json_encode(["command" => webSocket::BROADCASTIF, "jobid" => $this->job_id, "msg" => json_encode(["jid" => $this->job_id, "status" => Tasks::FINISH])]));
     $client->close();
     $task->status = Tasks::FINISH;
     $task->content = file_get_contents(storage_path("tmp/log" . $this->job_id . ".txt"));
     $task->save();
     unlink(storage_path("roles/yml" . $this->job_id));
     unlink(storage_path("roles/inv" . $this->job_id));
     unlink(storage_path("tmp/log" . $this->job_id . ".txt"));
     echo "End task: #" . $this->job_id, "\n";
 }
コード例 #3
0
ファイル: BackgroundTask.php プロジェクト: kangkot/bldr
 /**
  * Creates the given process
  *
  * @throws \Exception
  */
 private function startProcess(OutputInterface $output)
 {
     $arguments = $this->resolveProcessArgs();
     $name = sha1(serialize($arguments));
     if ($this->background->hasProcess($name)) {
         throw new \RuntimeException("Service is already running.");
     }
     $builder = new ProcessBuilder($arguments);
     if ($this->hasParameter('cwd')) {
         $builder->setWorkingDirectory($this->getParameter('cwd'));
     }
     $process = $builder->getProcess();
     if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE) {
         $output->writeln($process->getCommandLine());
     }
     if ($this->hasParameter('output')) {
         $append = $this->hasParameter('append') && $this->getParameter('append') ? 'a' : 'w';
         $stream = fopen($this->getParameter('output'), $append);
         $output = new StreamOutput($stream, StreamOutput::VERBOSITY_NORMAL, true);
     }
     $process->start(function ($type, $buffer) use($output) {
         $output->write($buffer);
     });
     $this->background->addProcess($name, $process);
     if (!in_array($process->getExitCode(), $this->getParameter('successCodes'))) {
         throw new TaskRuntimeException($this->getName(), $process->getErrorOutput());
     }
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function isTracked($file)
 {
     $processBuilder = new ProcessBuilder([$this->binaryPath, 'locate', $file]);
     $processBuilder->setWorkingDirectory($this->root);
     $process = $processBuilder->getProcess();
     $process->run();
     return $process->isSuccessful();
 }
コード例 #5
0
 public function __destruct()
 {
     if ($this->temp !== null) {
         $processBuilder = new ProcessBuilder(['rm', '-rf', $this->temp]);
         $processBuilder->setWorkingDirectory($this->root);
         $process = $processBuilder->getProcess();
         $process->run();
     }
 }
コード例 #6
0
ファイル: UpdateHelper.php プロジェクト: heartshare/dotplant2
 /**
  * Returns ProcessBuilder instance with predefined process command for migration command execution.
  *
  * @return \Symfony\Component\Process\ProcessBuilder
  */
 private function migrationCommandBuilder($migrationPath = '', $migrationTable = '{{%migration}}', $down = false)
 {
     $builder = new ProcessBuilder();
     $builder->setWorkingDirectory(Yii::getAlias('@app'))->setPrefix($this->getPhpExecutable())->setArguments([realpath(Yii::getAlias('@app') . '/yii'), 'migrate/' . ($down ? 'down' : 'up'), '--color=0', '--interactive=0', '--migrationTable=' . $migrationTable, $down ? 65536 : 0]);
     if (empty($migrationPath) === false) {
         $builder->add('--migrationPath=' . $migrationPath);
     }
     return $builder;
 }
コード例 #7
0
ファイル: Npm.php プロジェクト: hshn/HshnNpmBundle
 /**
  * @param array $commands
  * @param \Hshn\NpmBundle\Npm\ConfigurationInterface $configuration
  * @return \Symfony\Component\Process\Process
  */
 private function createProcess(array $commands, ConfigurationInterface $configuration)
 {
     $builder = new ProcessBuilder([$this->binPath]);
     $builder->setWorkingDirectory($configuration->getDirectory());
     $builder->setTimeout(600);
     foreach ($commands as $command) {
         $builder->add($command);
     }
     return $builder->getProcess();
 }
コード例 #8
0
ファイル: Installer.php プロジェクト: korstiaan/drunit
 protected function getProcess($drupal, $dsn)
 {
     $builder = new ProcessBuilder();
     $builder->inheritEnvironmentVariables(true);
     $builder->setWorkingDirectory($drupal);
     $builder->setPrefix('php');
     $builder->setArguments(array('-d sendmail_path=`which true`', $this->drush, 'site-install', 'standard', "--db-url={$dsn}", '-y'));
     $process = $builder->getProcess();
     return $process;
 }
コード例 #9
0
 /**
  * {@inheritdoc}
  */
 public function getProcessBuilder(array $arguments, $timeout = self::DEFAULT_PROCESS_TIMEOUT)
 {
     $builder = new ProcessBuilder();
     $builder->setPrefix($this->getPhpBinary());
     $builder->setWorkingDirectory($this->getCwd());
     $builder->setArguments($arguments);
     $builder->setTimeout($timeout);
     $builder->inheritEnvironmentVariables(true);
     return $builder;
 }
コード例 #10
0
ファイル: PhpFormatter.php プロジェクト: lin3s/cs
 /**
  * Executes the Marc Morera's PHP-Formatter sort use statements command.
  *
  * @param array $parameters The project parameters
  *
  * @throws \LIN3S\CS\Exception\CheckFailException
  */
 private static function sortUseStatements($parameters)
 {
     $processBuilder = new ProcessBuilder(['php', 'vendor/mmoreram/php-formatter/bin/php-formatter', 'formatter:use:sort', $parameters['phpformatter_path']]);
     $processBuilder->setWorkingDirectory($parameters['root_directory']);
     $process = $processBuilder->getProcess();
     $process->run();
     if (!$process->isSuccessful()) {
         throw new CheckFailException('PHP Formatter', 'Something fails during php formatter\'s sort uses process');
     }
 }
コード例 #11
0
ファイル: PreviewCommand.php プロジェクト: snipe/Couscous
 private function startWebServer(InputInterface $input, OutputInterface $output, $targetDirectory)
 {
     $builder = new ProcessBuilder([PHP_BINARY, '-S', $input->getArgument('address')]);
     $builder->setWorkingDirectory($targetDirectory);
     $builder->setTimeout(null);
     $process = $builder->getProcess();
     $process->start();
     $output->writeln(sprintf("Server running on <comment>%s</comment>", $input->getArgument('address')));
     return $process;
 }
コード例 #12
0
ファイル: Serve.php プロジェクト: carew/carew
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln(sprintf("Server running on <info>http://%s</info>\n", $input->getArgument('address')));
     $builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address')));
     $builder->setWorkingDirectory($input->getOption('web-dir'));
     $builder->setTimeout(null);
     $builder->getProcess()->mustRun(function ($type, $buffer) use($output) {
         if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
             $output->write($buffer);
         }
     });
 }
コード例 #13
0
 /**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln(sprintf("Server running on <info>%s</info>\n", $input->getArgument('address')));
     $builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), __DIR__ . '/../../../src/router.php'));
     $builder->setWorkingDirectory($input->getOption('docroot'));
     $builder->setTimeout(null);
     $builder->getProcess()->run(function ($type, $buffer) use($output) {
         if (OutputInterface::VERBOSITY_VERBOSE === $output->getVerbosity()) {
             $output->write($buffer);
         }
     });
 }
コード例 #14
0
 protected function execute($arguments)
 {
     array_unshift($arguments, $this->gitPath);
     $builder = new ProcessBuilder($arguments);
     $builder->setWorkingDirectory($this->repo);
     $process = $builder->getProcess();
     $process->run();
     if (!$process->isSuccessful()) {
         throw new \RuntimeException(sprintf('Unable to run the command (%s).', $process->getErrorOutput()));
     }
     return $process->getOutput();
 }
コード例 #15
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $router = $input->getOption('router') ?: $this->getContainer()->get('kernel')->locateResource('@FrameworkBundle/Resources/config/router.php');
     $output->writeln(sprintf("Server running on <info>%s</info>\n", $input->getArgument('address')));
     $builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router));
     $builder->setWorkingDirectory($input->getOption('docroot'));
     $builder->setTimeout(null);
     $builder->getProcess()->run(function ($type, $buffer) use($output) {
         if (OutputInterface::VERBOSITY_VERBOSE === $output->getVerbosity()) {
             $output->write($buffer);
         }
     });
 }
コード例 #16
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Start and run sentry monitor');
     $address = $input->getArgument('address');
     $webPath = __DIR__ . '/../../web';
     $processBuilder = new ProcessBuilder([PHP_BINARY, '-S', $address, $webPath . '/index.php']);
     $processBuilder->setWorkingDirectory($webPath . '/scripts')->setTimeout(null);
     $io->success(sprintf('Server running on "%s"', $address));
     $io->comment('Quit the server with CONTROL-C.');
     $process = $processBuilder->getProcess();
     $process->run();
 }
コード例 #17
0
 public function startServer()
 {
     $finder = new PhpExecutableFinder();
     if (false === ($binary = $finder->find())) {
         throw new \RuntimeException('Unable to find PHP binary to run server.');
     }
     $builder = new ProcessBuilder(['exec', $binary, '-S', $this->address, realpath(__DIR__ . '/../Resource/server.php')]);
     $builder->setWorkingDirectory(realpath(__DIR__ . '/../Resource'));
     $builder->setTimeout(null);
     $this->process = $builder->getProcess();
     $this->process->start();
     $this->waitServer();
 }
コード例 #18
0
ファイル: StartServer.php プロジェクト: dmitrynaum/sam
 /**
  * Запустить сервер
  * @param InputInterface $input
  * @param OutputInterface $output
  * @param string $targetDirectory
  * @return \Symfony\Component\Process\Process
  */
 private function startWebServer(InputInterface $input, OutputInterface $output, $targetDirectory)
 {
     $manifestPath = getcwd() . '/' . $input->getArgument('manifest');
     $manifest = new \Dmitrynaum\SAM\Component\Manifest($manifestPath);
     $address = $manifest->getServerAddress();
     $builder = new ProcessBuilder([PHP_BINARY, '-S', $address, 'server.php']);
     $builder->setWorkingDirectory($targetDirectory);
     $builder->setEnv('projectDir', getcwd());
     $builder->setEnv('manifestPath', $manifestPath);
     $builder->setTimeout(null);
     $process = $builder->getProcess();
     $process->start();
     $output->writeln(sprintf('Server running on <comment>%s</comment>', $address));
     return $process;
 }
コード例 #19
0
 /**
  * {@inheritdoc}
  */
 protected function doJob(JobData $data)
 {
     $app = $data->getApplication();
     $task = $data->getTask();
     $settings = simplexml_load_string($task->getSettings());
     $socketPort = (int) $settings->socket;
     $indexerPath = $this->getPhraseanetIndexerPath($app);
     $builder = new ProcessBuilder($this->getCommandline($indexerPath, $app, $task));
     $builder->setWorkingDirectory(dirname($indexerPath))->setTimeout(0);
     $process = $builder->getProcess();
     if (0 < $socketPort) {
         $this->addSubscriber(new PhraseanetIndexerStopperSubscriber($socketPort));
     }
     $process->run();
 }
コード例 #20
0
 public function compileAndWatch(Closure $callback = null)
 {
     $config = $this->webpackConfigManager->dump();
     $processBuilder = new ProcessBuilder();
     $processBuilder->setArguments(array_merge($this->devServerExecutable, array('--config', $config->getConfigPath()), $this->devServerArguments));
     $processBuilder->setWorkingDirectory($this->workingDirectory);
     $processBuilder->setTimeout(0);
     $prefix = DIRECTORY_SEPARATOR === '\\' ? array() : array('exec');
     $ttyPrefix = array_merge($prefix, $this->devServerTtyPrefix);
     $process = $this->buildProcess($processBuilder, $prefix, $ttyPrefix);
     $this->addEnvironment($process, 'WEBPACK_MODE=watch');
     // remove manifest file if exists - keep sure we create new one
     if (file_exists($this->manifestPath)) {
         $this->logger->info('Deleting manifest file', array($this->manifestPath));
         unlink($this->manifestPath);
     }
     $that = $this;
     $logger = $this->logger;
     $processCallback = function ($type, $buffer) use($that, $callback, $logger) {
         $that->saveManifest(false);
         $logger->info('Processing callback from process', array($type, $buffer));
         if ($callback !== null) {
             $callback($type, $buffer);
         }
     };
     $this->logger->info('Starting process', array($process->getCommandLine()));
     $process->start($processCallback);
     while (true) {
         sleep(1);
         $this->logger->debug('Dumping webpack configuration');
         $config = $this->webpackConfigManager->dump($config);
         if ($config->wasFileDumped()) {
             $this->logger->info('File was dumped (configuration changed) - restarting process', $config->getEntryPoints());
             $process->stop();
             $process = $process->restart($processCallback);
         } else {
             if (!$process->isRunning()) {
                 $this->logger->info('Process has shut down - returning');
                 return;
             }
             $process->getOutput();
             // try to save the manifest - output callback is not called in dashboard mode
             $that->saveManifest(false);
         }
     }
 }
コード例 #21
0
ファイル: ExecuteTask.php プロジェクト: gitter-badger/bldr
 /**
  * {@inheritDoc}
  */
 public function run(OutputInterface $output)
 {
     $arguments = $this->resolveProcessArgs();
     $builder = new ProcessBuilder($arguments);
     if (null !== ($dispatcher = $this->getEventDispatcher())) {
         $event = new PreExecuteEvent($this, $builder);
         $dispatcher->dispatch(Event::PRE_EXECUTE, $event);
         if ($event->isPropagationStopped()) {
             return true;
         }
     }
     if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERY_VERBOSE) {
         $output->writeln(sprintf('        // Setting timeout for %d seconds.', $this->getParameter('timeout')));
     }
     $builder->setTimeout($this->getParameter('timeout') !== 0 ? $this->getParameter('timeout') : null);
     if ($this->hasParameter('cwd')) {
         $builder->setWorkingDirectory($this->getParameter('cwd'));
     }
     $process = $builder->getProcess();
     if (get_class($this) === 'Bldr\\Block\\Execute\\Task\\ExecuteTask') {
         $output->writeln(['', sprintf('    <info>[%s]</info> - <comment>Starting</comment>', $this->getName()), '']);
     }
     if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE || $this->getParameter('dry_run')) {
         $output->writeln('        // ' . $process->getCommandLine());
     }
     if ($this->getParameter('dry_run')) {
         return true;
     }
     if ($this->hasParameter('output')) {
         $append = $this->hasParameter('append') && $this->getParameter('append') ? 'a' : 'w';
         $stream = fopen($this->getParameter('output'), $append);
         $output = new StreamOutput($stream, StreamOutput::VERBOSITY_NORMAL, true);
     }
     $process->start(function ($type, $buffer) use($output) {
         $output->write("\r        " . str_replace("\n", "\n        ", $buffer));
     });
     while ($process->isRunning()) {
     }
     if (null !== $dispatcher) {
         $event = new PostExecuteEvent($this, $process);
         $dispatcher->dispatch(Event::POST_EXECUTE, $event);
     }
     if (!in_array($process->getExitCode(), $this->getParameter('successCodes'))) {
         throw new TaskRuntimeException($this->getName(), $process->getErrorOutput());
     }
 }
コード例 #22
0
ファイル: ServerRunCommand.php プロジェクト: dev-lav/htdocs
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $env = $this->getContainer()->getParameter('kernel.environment');
     if ('prod' === $env) {
         $output->writeln('<error>Running PHP built-in server in production environment is NOT recommended!</error>');
     }
     $router = $input->getOption('router') ?: $this->getContainer()->get('kernel')->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env));
     $output->writeln(sprintf("Server running on <info>%s</info>\n", $input->getArgument('address')));
     $builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router));
     $builder->setWorkingDirectory($input->getOption('docroot'));
     $builder->setTimeout(null);
     $builder->getProcess()->run(function ($type, $buffer) use($output) {
         if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
             $output->write($buffer);
         }
     });
 }
コード例 #23
0
ファイル: Phpmd.php プロジェクト: lin3s/cs
 /**
  * {@inheritdoc}
  */
 public static function check(array $files = [], array $parameters = null)
 {
     $errors = [];
     foreach ($files as $file) {
         if (false === self::exist($file, $parameters['phpmd_path'], 'php')) {
             continue;
         }
         $processBuilder = new ProcessBuilder(['php', 'vendor/phpmd/phpmd/src/bin/phpmd', $file, 'text', implode(',', $parameters['phpmd_rules'])]);
         $processBuilder->setWorkingDirectory($parameters['root_directory']);
         $process = $processBuilder->getProcess();
         $process->run();
         if (!$process->isSuccessful()) {
             $errors[] = new Error($file, sprintf('<error>%s</error>', trim($process->getErrorOutput())), sprintf('<error>%s</error>', trim($process->getOutput())));
         }
     }
     return $errors;
 }
コード例 #24
0
 /**
  * Performs immediate task start - fire and forget.
  * Used in web requests to start task in background.
  * @param integer $taskId
  */
 public static function runImmediateTask($taskId)
 {
     $command = new ProcessBuilder();
     $command->setWorkingDirectory(Yii::getAlias('@app'));
     if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
         $command->setPrefix('yii.bat');
     } else {
         $command->setPrefix('./yii');
     }
     $command->add('deferred/index')->add("{$taskId}");
     $process = $command->getProcess();
     $process->setWorkingDirectory(Yii::getAlias('@app'));
     $process->setCommandLine($process->getCommandLine() . ' > /dev/null 2>&1 &');
     if (isset(Yii::$app->params['deferred.env'])) {
         $process->setEnv(Yii::$app->params['deferred.env']);
     }
     $process->run();
 }
コード例 #25
0
 /**
  * Sets the working directory.
  *
  * @param null|string $cwd The working directory
  *
  * @return ProcessBuilderProxyInterface
  */
 public function setWorkingDirectory(string $cwd) : ProcessBuilderProxyInterface
 {
     $this->cwd = $cwd;
     $this->processBuilder->setWorkingDirectory($cwd);
     return $this;
 }
コード例 #26
0
ファイル: CodeQualityTool.php プロジェクト: cubiche/cqt
 /**
  * @return bool
  */
 private function codeStylePsr()
 {
     $succeed = true;
     foreach (GitUtils::commitedFiles() as $file) {
         $processBuilder = new ProcessBuilder(array('php', 'bin/phpcs', '--standard=PSR2', $file));
         $processBuilder->setWorkingDirectory(getcwd());
         $phpCsFixer = $processBuilder->getProcess();
         $phpCsFixer->run(function ($type, $buffer) {
             $this->output->write($buffer);
         });
         if (!$phpCsFixer->isSuccessful()) {
             $this->output->writeln(sprintf('<error>%s</error>', trim($phpCsFixer->getOutput())));
             $succeed = false;
         }
     }
     return $succeed;
 }
コード例 #27
0
ファイル: YoutubeDl.php プロジェクト: norkunas/youtube-dl-php
 private function createProcessBuilder(array $arguments = []) : ProcessBuilder
 {
     $binPath = $this->binPath ?: (new ExecutableFinder())->find('youtube-dl');
     if (null === $binPath) {
         throw new ExecutableNotFoundException('"youtube-dl" executable was not found. Did you forgot to add it to environment variables? Or set it via $yt->setBinPath(\'/usr/bin/youtube-dl\').');
     }
     $builder = new ProcessBuilder($arguments);
     $builder->setPrefix($binPath);
     $builder->setTimeout($this->timeout);
     if ($this->downloadPath) {
         $builder->setWorkingDirectory($this->downloadPath);
     }
     return $builder;
 }
 /**
  * Retrieve the data of the current user on the system.
  *
  * @param GitRepository $git The repository to extract all files from.
  *
  * @return string
  *
  * @throws GitException When the git execution failed.
  */
 private function getCurrentUserInfo($git)
 {
     // Sadly no command in our git library for this.
     $processBuilder = new ProcessBuilder();
     $processBuilder->setWorkingDirectory($git->getRepositoryPath());
     $processBuilder->add($git->getConfig()->getGitExecutablePath())->add('config')->add('--get-regexp')->add('user.[name|email]');
     $process = $processBuilder->getProcess();
     $git->getConfig()->getLogger()->debug(sprintf('[ccabs-repository-git] exec [%s] %s', $process->getWorkingDirectory(), $process->getCommandLine()));
     $process->run();
     $output = rtrim($process->getOutput(), "\r\n");
     if (!$process->isSuccessful()) {
         throw GitException::createFromProcess('Could not execute git command', $process);
     }
     $config = array();
     foreach (explode(PHP_EOL, $output) as $line) {
         list($name, $value) = explode(' ', $line, 2);
         $config[trim($name)] = trim($value);
     }
     if (isset($config['user.name']) && $config['user.email']) {
         return sprintf('%s <%s>', $config['user.name'], $config['user.email']);
     }
     return '';
 }
コード例 #29
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $module = $input->getArgument('module');
     $latest = $input->getOption('latest');
     $composer = $input->getOption('composer');
     $this->site->loadLegacyFile('/core/includes/bootstrap.inc');
     // check module's requirements
     $this->moduleRequirement($module);
     if ($composer) {
         foreach ($module as $moduleItem) {
             $command = sprintf('composer show drupal/%s ', $moduleItem);
             $processBuilder = new ProcessBuilder([]);
             $processBuilder->setWorkingDirectory($this->appRoot);
             $processBuilder->setArguments(explode(" ", $command));
             $process = $processBuilder->getProcess();
             $process->setTty('true');
             $process->run();
             if ($process->isSuccessful()) {
                 $io->info(sprintf('Module %s was downloaded with Composer.', $moduleItem));
             } else {
                 $io->error(sprintf('Module %s seems not to be installed with Composer. Halting.', $moduleItem));
                 throw new \RuntimeException($process->getErrorOutput());
                 return 0;
             }
         }
         $unInstalledModules = $module;
     } else {
         $resultList = $this->downloadModules($io, $module, $latest);
         $invalidModules = $resultList['invalid'];
         $unInstalledModules = $resultList['uninstalled'];
         if ($invalidModules) {
             foreach ($invalidModules as $invalidModule) {
                 unset($module[array_search($invalidModule, $module)]);
                 $io->error(sprintf('Invalid module name: %s', $invalidModule));
             }
         }
         if (!$unInstalledModules) {
             $io->warning($this->trans('commands.module.install.messages.nothing'));
             return 0;
         }
     }
     try {
         $io->comment(sprintf($this->trans('commands.module.install.messages.installing'), implode(', ', $unInstalledModules)));
         drupal_static_reset('system_rebuild_module_data');
         $this->moduleInstaller->install($unInstalledModules, true);
         $io->success(sprintf($this->trans('commands.module.install.messages.success'), implode(', ', $unInstalledModules)));
     } catch (\Exception $e) {
         $io->error($e->getMessage());
         return 1;
     }
     $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']);
 }
コード例 #30
-1
 /**
  * Checks if the render check commands returns "[OK]"
  */
 public function testRenderCheckOk()
 {
     $pb = new ProcessBuilder();
     $pb->setWorkingDirectory(realpath(__DIR__ . '\\..\\..\\..'))->setArguments(['php', 'bin/console', 'render:check']);
     $out = $pb->getProcess()->mustRun()->getOutput();
     $this->assertContains('[OK]', $out);
 }