Added fallback for local env to server overview widget

This commit is contained in:
Constantin Graf
2024-10-08 19:28:07 +02:00
committed by Gregor Vostrak
parent 2372ee0622
commit 7af1990935
2 changed files with 24 additions and 8 deletions

View File

@@ -16,18 +16,22 @@ class ServerOverview extends Widget
*/
protected function getViewData(): array
{
$currentVersion = Cache::get('latest_version', null);
/** @var string|null $currentVersion */
$currentVersion = config('app.version');
/** @var string|null $build */
$build = config('app.build');
$latestVersion = Cache::get('latest_version', null);
$needsUpdate = false;
if ($currentVersion !== null && version_compare($currentVersion, config('app.version')) > 0) {
if ($latestVersion !== null && $currentVersion !== null && version_compare($latestVersion, $currentVersion) > 0) {
$needsUpdate = true;
}
return [
'version' => config('app.version'),
'build' => config('app.build'),
'version' => $currentVersion,
'build' => $build,
'environment' => config('app.env'),
'currentVersion' => $currentVersion,
'currentVersion' => $latestVersion,
'needsUpdate' => $needsUpdate,
];
}