1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Check for node and npm in setup

This commit is contained in:
David Bomba 2020-07-21 11:11:35 +10:00
parent 8420a4bac1
commit 24e64fa911
3 changed files with 72 additions and 0 deletions

View File

@ -205,4 +205,6 @@ class SetupController extends Controller
return response([], 500);
}
}
}

View File

@ -71,9 +71,43 @@ class SystemHealth
'env_writable' => self::checkEnvWritable(),
//'mail' => self::testMailServer(),
'simple_db_check' => (bool) self::simpleDbCheck(),
'npm_status' => self::checkNpm(),
'node_status' => self::checkNode(),
];
}
public static function checkNode()
{
try {
exec('node -v', $foo, $exitCode);
if ($exitCode === 0) {
return $exitCode;
}
} catch (\Exception $e) {
return false;
}
}
public static function checkNpm()
{
try {
exec('npm -v', $foo, $exitCode);
if ($exitCode === 0) {
return $exitCode;
}
}catch (\Exception $e) {
return false;
}
}
private static function simpleDbCheck() :bool
{
$result = true;

View File

@ -61,6 +61,42 @@
@endif
</dd>
</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">
<dt class="text-sm leading-5 font-medium text-gray-500">
{{ ctrans('texts.npm_status') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
@if($check['npm_status'])
<span class="alert alert-success block flex justify-between items-center">
<span>{{ strtoupper(ctrans('texts.ok')) }}</span>
<span></span>
</span>
@else
<span class="alert alert-failure block flex justify-between items-center">
<span>{{ ctrans('texts.npm_status_not_found') }}</span>
<span></span>
</span>
@endif
</dd>
</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">
<dt class="text-sm leading-5 font-medium text-gray-500">
{{ ctrans('texts.node_status') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
@if($check['node_status'])
<span class="alert alert-success block flex justify-between items-center">
<span>{{ strtoupper(ctrans('texts.ok')) }}</span>
<span></span>
</span>
@else
<span class="alert alert-failure block flex justify-between items-center">
<span>{{ ctrans('texts.node_status_not_found') }}</span>
<span></span>
</span>
@endif
</dd>
</div>
</dl>
</div>
</div>