From deb6a18e7991be7761177fcf9dbafbbd6f29f853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 27 Jul 2020 16:55:26 +0200 Subject: [PATCH] Don't show setup page if node or npm are missing --- app/Utils/SystemHealth.php | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index 9d0f031202e5..b752c377647c 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -49,17 +49,25 @@ class SystemHealth if (in_array(false, Arr::dot(self::extensions()))) { $system_health = false; - } - + } + if (phpversion() < self::$php_version) { $system_health = false; - } + } if(!self::simpleDbCheck() && $check_database) { info("db fails"); $system_health = false; } + if (!self::checkNode()) { + $system_health = false; + } + + if (!self::checkNpm()) { + $system_health = false; + } + return [ 'system_health' => $system_health, 'extensions' => self::extensions(), @@ -82,14 +90,13 @@ class SystemHealth exec('node -v', $foo, $exitCode); if ($exitCode === 0) { - return $foo[0]; + return true; } - + + return false; } catch (\Exception $e) { - - return false; + return false; } - } public static function checkNpm() @@ -98,14 +105,14 @@ class SystemHealth exec('npm -v', $foo, $exitCode); if ($exitCode === 0) { - return $foo[0]; - } + return true; + } - }catch (\Exception $e) { - - return false; + return false; + + } catch (\Exception $e) { + return false; } - } private static function simpleDbCheck() :bool