1
0
mirror of https://github.com/flarum/core.git synced 2025-07-25 18:51:40 +02:00

Check some requirements before installation

This commit is contained in:
Toby Zerner
2015-08-27 20:11:06 +09:30
parent 22182f3106
commit 65901ce216
3 changed files with 56 additions and 5 deletions

View File

@@ -40,8 +40,29 @@ class IndexAction extends HtmlAction
$view->logo = $this->view->make('flarum.install::logo');
$view->content = $this->view->make('flarum.install::install');
$view->content->input = [];
$errors = [];
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
$errors[] = [
'message' => '<strong>PHP 5.5+</strong> is required.',
'detail' => 'You are running version '.PHP_VERSION.'.'
];
}
foreach (['mbstring', 'pdo_mysql'] as $extension) {
if (! extension_loaded($extension)) {
$errors[] = [
'message' => 'The <strong>'.$extension.'</strong> extension is required.'
];
}
}
if (count($errors)) {
$view->content = $this->view->make('flarum.install::errors');
$view->content->errors = $errors;
} else {
$view->content = $this->view->make('flarum.install::install');
}
return $view;
}