From deee4184b762f69b31d541fa3c049d8abba93851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20R?= Date: Wed, 19 Apr 2017 14:34:39 +0200 Subject: [PATCH] EZP-27256: Installer could be more helpful on errors (#1958) --- .../src/Command/InstallPlatformCommand.php | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/eZ/Bundle/PlatformInstallerBundle/src/Command/InstallPlatformCommand.php b/eZ/Bundle/PlatformInstallerBundle/src/Command/InstallPlatformCommand.php index 68df70e2f47..afbcf5c39ca 100644 --- a/eZ/Bundle/PlatformInstallerBundle/src/Command/InstallPlatformCommand.php +++ b/eZ/Bundle/PlatformInstallerBundle/src/Command/InstallPlatformCommand.php @@ -90,7 +90,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $type = $input->getArgument('type'); $installer = $this->getInstaller($type); if ($installer === false) { - $output->writeln("Unknown install type '$type'"); + $output->writeln( + "Unknown install type '$type', available options in currently installed eZ Platform package: " . + implode(', ', array_keys($this->installers)) + ); exit(self::EXIT_UNKNOWN_INSTALL_TYPE); } @@ -115,7 +118,7 @@ private function checkParameters() { $parametersFile = 'app/config/parameters.yml'; if (!is_file($parametersFile)) { - $this->output->writeln("Required configuration file $parametersFile not found"); + $this->output->writeln("Required configuration file '$parametersFile' not found"); exit(self::EXIT_PARAMETERS_NOT_FOUND); } } @@ -151,9 +154,9 @@ private function checkDatabase() exit(self::EXIT_DATABASE_NOT_FOUND_ERROR); } } catch (ConnectionException $e) { - $this->output->writeln('An error occured connecting to the database:'); + $this->output->writeln('An error occurred connecting to the database:'); $this->output->writeln($e->getMessage()); - $this->output->writeln('Please check the database configuration in parameters.yml'); + $this->output->writeln("Please check the database configuration in 'app/config/parameters.yml'"); exit(self::EXIT_GENERAL_DATABASE_ERROR); } } @@ -161,7 +164,12 @@ private function checkDatabase() private function cacheClear(OutputInterface $output) { if (!is_writable($this->cacheDir)) { - throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $this->cacheDir)); + throw new \RuntimeException( + sprintf( + 'Unable to write in the "%s" directory, check install doc on disk permissions before you continue.', + $this->cacheDir + ) + ); } $output->writeln(sprintf('Clearing cache for directory %s', $this->cacheDir)); @@ -217,7 +225,7 @@ private function getInstaller($type) /** * Executes a Symfony command in separate process. * - * Typically usefull when configuration has changed, our you are outside of Symfony context (Composer commands). + * Typically useful when configuration has changed, or you are outside of Symfony context (Composer commands). * * Based on {@see \Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeCommand}. *