diff --git a/src/InitCommand.php b/src/InitCommand.php index 3295462..25b30e4 100644 --- a/src/InitCommand.php +++ b/src/InitCommand.php @@ -42,19 +42,28 @@ protected function execute(InputInterface $input, OutputInterface $output) (new Filesystem())->remove($this->getDocumentRoot()); - $io->comment('Downloading latest version of phpMyAdmin...'); - $package = 'phpmyadmin/phpmyadmin'; if ($version) { $package .= ':'.$version; } - (new Process(['composer', 'create-project', $package, '.phpmyadmin'], $this->getHomeDir())) + $io->comment(\sprintf('Downloading phpMyAdmin %s...', $version ?: 'latest')); + + $process = (new Process(['composer', 'create-project', $package, '.phpmyadmin'], $this->getHomeDir())) ->setTimeout(null) - ->run() ; + $process->run(function($type, $buffer) use ($io) { + if ($io->isVerbose()) { + $io->writeln($buffer); + } + }); + + if (!$process->isSuccessful()) { + throw new \RuntimeException($process->getErrorOutput()); + } + $io->comment('Generating config.inc.php'); $config = \file_get_contents(__DIR__.'/../resources/config.inc.template'); \file_put_contents($this->getDocumentRoot().'/config.inc.php', \strtr($config, [