Merge pull request #3887 from beganovich/v2-0607-setup-page-fixes

Fix form not showing when DB fails on setup
This commit is contained in:
David Bomba 2020-07-07 08:07:27 +10:00 committed by GitHub
commit 16f488be5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 10 deletions

View File

@ -37,9 +37,9 @@ class SetupController extends Controller
*/ */
public function index() public function index()
{ {
$check = SystemHealth::check(); $check = SystemHealth::check(false);
if($check['system_health'] == "true" && Schema::hasTable('accounts') && $account = Account::all()->first()) { if($check['system_health'] == true && $check['simple_db_check'] && Schema::hasTable('accounts') && $account = Account::all()->first()) {
return redirect('/'); return redirect('/');
} }
@ -48,7 +48,7 @@ class SetupController extends Controller
public function doSetup(StoreSetupRequest $request) public function doSetup(StoreSetupRequest $request)
{ {
$check = SystemHealth::check(); $check = SystemHealth::check(false);
if ($check['system_health'] === false) { if ($check['system_health'] === false) {
info($check); info($check);
@ -145,8 +145,6 @@ class SetupController extends Controller
{ {
$status = SystemHealth::dbCheck($request); $status = SystemHealth::dbCheck($request);
info($status);
if (is_array($status) && $status['success'] === true) { if (is_array($status) && $status['success'] === true) {
return response([], 200); return response([], 200);
} }

View File

@ -43,15 +43,19 @@ class SystemHealth
* *
* @return array Result set of checks * @return array Result set of checks
*/ */
public static function check() : array public static function check($check_database = true) : 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) { }
if (phpversion() < self::$php_version) {
$system_health = false; $system_health = false;
} elseif(!self::simpleDbCheck()) { }
if(!self::simpleDbCheck() && $check_database) {
info("db fails"); info("db fails");
$system_health = false; $system_health = false;
} }
@ -66,6 +70,7 @@ class SystemHealth
], ],
'env_writable' => self::checkEnvWritable(), 'env_writable' => self::checkEnvWritable(),
//'mail' => self::testMailServer(), //'mail' => self::testMailServer(),
'simple_db_check' => (bool) self::simpleDbCheck(),
]; ];
} }

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,6 @@
"/js/clients/quotes/action-selectors.js": "/js/clients/quotes/action-selectors.js?id=b6b33ab51b58b51e1212", "/js/clients/quotes/action-selectors.js": "/js/clients/quotes/action-selectors.js?id=b6b33ab51b58b51e1212",
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=1c5d76fb5f98bd49f6c8", "/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=1c5d76fb5f98bd49f6c8",
"/js/clients/shared/pdf.js": "/js/clients/shared/pdf.js?id=ba1182244cda0e0ffbeb", "/js/clients/shared/pdf.js": "/js/clients/shared/pdf.js?id=ba1182244cda0e0ffbeb",
"/js/setup/setup.js": "/js/setup/setup.js?id=045266c33610abf0dbd0", "/js/setup/setup.js": "/js/setup/setup.js?id=c4cd098778bf824a3470",
"/css/card-js.min.css": "/css/card-js.min.css?id=62afeb675235451543ad" "/css/card-js.min.css": "/css/card-js.min.css?id=62afeb675235451543ad"
} }