Fixes for setup page check

This commit is contained in:
Benjamin Beganović 2020-06-30 14:28:14 +02:00
parent d1b5de5e25
commit 3df91f15e2
4 changed files with 17 additions and 10 deletions

View File

@ -35,8 +35,9 @@ class SetupController extends Controller
{ {
$check = SystemHealth::check(); $check = SystemHealth::check();
if($check['system_health'] == "true" && Schema::hasTable('accounts') && $account = Account::all()->first()) if($check['system_health'] == "true" && Schema::hasTable('accounts') && $account = Account::all()->first()) {
return redirect('/'); return redirect('/');
}
$check = SystemHealth::check(); $check = SystemHealth::check();
@ -48,7 +49,7 @@ class SetupController extends Controller
$check = SystemHealth::check(); $check = SystemHealth::check();
if ($check['system_health'] === false) { if ($check['system_health'] === false) {
return back(); // This should never be reached. return response('Oops, something went wrong. Check your logs.'); /** We should never reach this block, but jic. */
} }
$mail_driver = $request->input('mail_driver'); $mail_driver = $request->input('mail_driver');

View File

@ -45,15 +45,15 @@ class SystemHealth
*/ */
public static function check() : array public static function check() : array
{ {
$system_health = "true"; $system_health = true;
if (in_array(false, Arr::dot(self::extensions()))) { if (in_array(false, Arr::dot(self::extensions()))) {
$system_health = "false"; $system_health = false;
} elseif (phpversion() < self::$php_version) { } elseif (phpversion() < self::$php_version) {
$system_health = "false"; $system_health = false;
} elseif(!self::simpleDbCheck()) { } elseif(!self::simpleDbCheck()) {
info("db fails"); info("db fails");
$system_health = "false"; $system_health = false;
} }
return [ return [

View File

@ -3224,8 +3224,12 @@ return [
'year_invalid' => 'Provided year is not valid.', 'year_invalid' => 'Provided year is not valid.',
'https_required' => 'HTTPS is required, form will fail', 'https_required' => 'HTTPS is required, form will fail',
'if_you_need_help' => 'If you need help you can either post to our', 'if_you_need_help' => 'If you need help you can post to our',
'reversed' => 'Reversed', 'reversed' => 'Reversed',
'update_password_on_confirm' => 'After updating password, your account will be confirmed.', 'update_password_on_confirm' => 'After updating password, your account will be confirmed.',
'bank_account_not_linked' => 'To pay with bank account, first you have to add it as payment method.', 'bank_account_not_linked' => 'To pay with bank account, first you have to add it as payment method.',
'application_settings_label' => 'Let\'s store basic information about your Invoice Ninja!',
'recommended_in_production' => 'Recommended in production',
'enable_only_for_development' => 'Enable only for development',
]; ];

View File

@ -1,10 +1,10 @@
<div class="bg-white shadow overflow-hidden rounded-lg mt-8"> <div class="bg-white shadow overflow-hidden rounded-lg mt-8">
<div class="px-4 py-5 border-b border-gray-200 sm:px-6"> <div class="px-4 py-5 border-b border-gray-200 sm:px-6">
<h3 class="text-lg leading-6 font-medium text-gray-900"> <h3 class="text-lg leading-6 font-medium text-gray-900">
Application settings {{ ctrans('texts.application_settings') }}
</h3> </h3>
<p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500"> <p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500">
Let's store basic information about your Invoice Ninja! {{ ctrans('texts.application_settings_label') }}
</p> </p>
</div> </div>
<div> <div>
@ -22,8 +22,9 @@
{{ ctrans('texts.https') }} {{ ctrans('texts.https') }}
</dt> </dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2"> <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
<input type="checkbox" class="form-checkbox mr-1" name="https" {{ old('https') ? 'checked': '' }}> <input type="checkbox" class="form-checkbox mr-1" name="https" {{ old('https') ? 'checked': '' }} checked>
<span>{{ ctrans('texts.require') }}</span> <span>{{ ctrans('texts.require') }}</span>
<span class="text-gray-600 text-xs ml-2">({{ ctrans('texts.recommended_in_production') }})</span>
</dd> </dd>
</div> </div>
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 sm:flex sm:items-center"> <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 sm:flex sm:items-center">
@ -33,6 +34,7 @@
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2"> <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
<input type="checkbox" class="form-checkbox mr-1" name="debug" {{ old('debug') ? 'checked': '' }}> <input type="checkbox" class="form-checkbox mr-1" name="debug" {{ old('debug') ? 'checked': '' }}>
<span>{{ ctrans('texts.enable') }}</span> <span>{{ ctrans('texts.enable') }}</span>
<span class="text-gray-600 text-xs ml-2">({{ ctrans('texts.enable_only_for_development') }})</span>
</dd> </dd>
</div> </div>
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 sm:flex sm:items-center"> <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 sm:flex sm:items-center">