Don't show setup page if node or npm are missing

This commit is contained in:
Benjamin Beganović 2020-07-27 16:55:26 +02:00
parent c2cae00016
commit deb6a18e79

View File

@ -49,17 +49,25 @@ class SystemHealth
if (in_array(false, Arr::dot(self::extensions()))) { if (in_array(false, Arr::dot(self::extensions()))) {
$system_health = false; $system_health = false;
} }
if (phpversion() < self::$php_version) { if (phpversion() < self::$php_version) {
$system_health = false; $system_health = false;
} }
if(!self::simpleDbCheck() && $check_database) { if(!self::simpleDbCheck() && $check_database) {
info("db fails"); info("db fails");
$system_health = false; $system_health = false;
} }
if (!self::checkNode()) {
$system_health = false;
}
if (!self::checkNpm()) {
$system_health = false;
}
return [ return [
'system_health' => $system_health, 'system_health' => $system_health,
'extensions' => self::extensions(), 'extensions' => self::extensions(),
@ -82,14 +90,13 @@ class SystemHealth
exec('node -v', $foo, $exitCode); exec('node -v', $foo, $exitCode);
if ($exitCode === 0) { if ($exitCode === 0) {
return $foo[0]; return true;
} }
return false;
} catch (\Exception $e) { } catch (\Exception $e) {
return false;
return false;
} }
} }
public static function checkNpm() public static function checkNpm()
@ -98,14 +105,14 @@ class SystemHealth
exec('npm -v', $foo, $exitCode); exec('npm -v', $foo, $exitCode);
if ($exitCode === 0) { 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 private static function simpleDbCheck() :bool