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:
@@ -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>');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user