protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = $this->getApplication()->configForInstall($input->getArgument('install_name'));
     $output->writeln('Check current version :');
     $pathInstall = $config['php_dir'];
     exec($pathInstall . DIRECTORY_SEPARATOR . 'php.exe -v', $out);
     if (empty($out)) {
         throw new \Exception('Unable to execute php.exe on php_dir', 1);
     }
     foreach ($out as $key => $value) {
         if ($key === 0) {
             $value = sprintf('<info>%s</info>', $value);
         }
         $output->writeln($value);
     }
     exec($pathInstall . DIRECTORY_SEPARATOR . 'php.exe -m', $out2);
     $output->writeln('');
     $output->writeln('<comment>Modules enabled :</comment>');
     $output->writeln(implode(', ', $out2));
     $updater = new UpdatePhpInstall($config, $this->getApplication()->getSources());
     if (false !== ($version = $updater->updateAvailable())) {
         $output->writeln('');
         $output->writeln('New version available : <comment>' . $version . '</comment>');
     }
 }
Ejemplo n.º 2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = $this->getApplication()->configForInstall($input->getArgument('install_name'));
     $updater = new UpdatePhpInstall($config, $this->getApplication()->getSources());
     $branch = $config['php_branch'];
     $output->writeln(sprintf('Branch PHP : <info>%s</info>', $branch));
     $latest = $this->getApplication()->getSources()->latestVersionForBranch($branch);
     $output->writeln(sprintf('Version to install : <info>%s</info>', $latest));
     if ($input->getOption('no-install')) {
         $output->writeln('<comment>No Install option !</comment>');
         return 0;
     }
     $updater->update($latest, $output);
     $command = $this->getApplication()->find('php:version');
     $command->run(new ArrayInput(['install_name' => $input->getArgument('install_name')]), $output);
 }