1
0
mirror of https://github.com/flarum/core.git synced 2025-10-12 23:44:27 +02:00

Check prerequisites in console installer, too

This commit is contained in:
Franz Liedke
2015-09-03 08:42:16 +02:00
parent 942db77416
commit 3c9d851889
4 changed files with 37 additions and 7 deletions

View File

@@ -62,11 +62,22 @@ class InstallCommand extends Command
{
$this->init();
$this->info('Installing Flarum...');
$prerequisites = $this->getPrerequisites();
$prerequisites->check();
$errors = $prerequisites->getErrors();
$this->install();
if (empty($errors)) {
$this->info('Installing Flarum...');
$this->info('DONE.');
$this->install();
$this->info('DONE.');
} else {
$this->output->writeln(
'<error>Please fix the following errors before we can continue with the installation.</error>'
);
$this->showErrors($errors);
}
}
protected function init()
@@ -275,4 +286,23 @@ class InstallCommand extends Command
{
return base_path('../config.php');
}
/**
* @return \Flarum\Install\Prerequisites\Prerequisite
*/
protected function getPrerequisites()
{
return $this->application->make('Flarum\Install\Prerequisites\Prerequisite');
}
protected function showErrors($errors)
{
foreach ($errors as $error) {
$this->info($error['message']);
if (isset($error['detail'])) {
$this->output->writeln('<comment>' . $error['detail'] . '</comment>');
}
}
}
}