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;
}

View File

@ -128,6 +128,34 @@
-webkit-animation-name: fadeIn;
animation-name: fadeIn;
}
.Errors {
margin-top: 50px;
}
.Errors .Error:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.Errors .Error:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
.Error {
background: #EDF2F7;
margin: 0 0 1px;
padding: 20px 25px;
text-align: left;
}
.Error-message {
font-size: 16px;
color: #3C5675;
font-weight: normal;
margin: 0;
}
.Error-detail {
font-size: 13px;
margin: 5px 0 0;
}
</style>
</head>

View File

@ -1,12 +1,14 @@
<h2>Hold Up!</h2>
<p>These errors must be resolved before you can continue the installation.</p>
<p>These errors must be resolved before you can continue the installation. If you're having trouble, get help on the <a href="http://flarum.org/docs/troubleshooting" target="_blank">Flarum website</a>.</p>
<div class="Errors">
@foreach ($errors as $error)
<div class="Error">
<h3 class="Error-message">{{ $error['message'] }}</h3>
<p class="Error-detail">{{ $error['detail'] }}</p>
<h3 class="Error-message">{!! $error['message'] !!}</h3>
@if (! empty($error['detail']))
<p class="Error-detail">{!! $error['detail'] !!}</p>
@endif
</div>
@endforeach
</div>