parent
8e35c617b8
commit
3b816e2198
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
use App\Models\Setting;
|
use App\Models\Setting as SettingsModel;
|
||||||
use App\Support\CacheVer;
|
use App\Support\CacheVer;
|
||||||
use App\Support\WoltGuard\Probes;
|
use App\Support\WoltGuard\Probes;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
|
@ -39,7 +39,10 @@ class RunHealthChecks implements ShouldQueue
|
||||||
|
|
||||||
$payload = ['ts' => time(), 'rows' => $svcRows];
|
$payload = ['ts' => time(), 'rows' => $svcRows];
|
||||||
Cache::put(CacheVer::k('health:services'), $payload, 300);
|
Cache::put(CacheVer::k('health:services'), $payload, 300);
|
||||||
Setting::set('woltguard.services', $payload);
|
Log::info('WG: writing services', ['count'=>count($svcRows)]);
|
||||||
|
SettingsModel::set('woltguard.services', $payload);
|
||||||
|
Cache::forget('health:services');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Wraps a probe; logs and returns fallback on error */
|
/** Wraps a probe; logs and returns fallback on error */
|
||||||
|
|
|
||||||
|
|
@ -242,12 +242,7 @@ class UpdateCard extends Component
|
||||||
$rcRaw = @trim(@file_get_contents('/var/lib/mailwolt/update/rc') ?: '');
|
$rcRaw = @trim(@file_get_contents('/var/lib/mailwolt/update/rc') ?: '');
|
||||||
|
|
||||||
$this->rc = is_numeric($rcRaw) ? (int)$rcRaw : null;
|
$this->rc = is_numeric($rcRaw) ? (int)$rcRaw : null;
|
||||||
|
|
||||||
// ← harte Wahrheit: Sobald es eine rc gibt, ist es NICHT mehr running –
|
|
||||||
// selbst wenn "state" (noch) "running" enthält.
|
|
||||||
$this->running = ($this->rc === null) && ($state !== 'done');
|
$this->running = ($this->rc === null) && ($state !== 'done');
|
||||||
|
|
||||||
// optional: letzte Logzeile für die UI
|
|
||||||
$this->progressLine = $this->tailUpdateLog();
|
$this->progressLine = $this->tailUpdateLog();
|
||||||
|
|
||||||
// $state = @trim(@file_get_contents('/var/lib/mailwolt/update/state') ?: '');
|
// $state = @trim(@file_get_contents('/var/lib/mailwolt/update/state') ?: '');
|
||||||
|
|
|
||||||
|
|
@ -75,24 +75,38 @@ class WoltguardCard extends Component
|
||||||
// elseif (isset($val[0]) && is_array($val[0]) && array_key_exists('name', $val[0])) {
|
// elseif (isset($val[0]) && is_array($val[0]) && array_key_exists('name', $val[0])) {
|
||||||
// $rows = $val;
|
// $rows = $val;
|
||||||
// }
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $list = Cache::get(CacheVer::k('health:services'));
|
||||||
|
// if (empty($list)) {
|
||||||
|
// // Fallback: aus DB/Redis (persistiert vom Job)
|
||||||
|
// $list = \App\Support\Setting::get('woltguard.services', []);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// $rows = [];
|
||||||
|
// if (is_array($list)) {
|
||||||
|
// // neues Format: ['ts'=>..., 'rows'=>[...]]
|
||||||
|
// if (isset($list['rows']) && is_array($list['rows'])) {
|
||||||
|
// $rows = $list['rows'];
|
||||||
|
// }
|
||||||
|
// // altes Format: direkt die Array-Liste
|
||||||
|
// elseif (isset($list[0]) && is_array($list[0])) {
|
||||||
|
// $rows = $list;
|
||||||
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$list = Cache::get(CacheVer::k('health:services'));
|
$list = Cache::get(CacheVer::k('health:services'));
|
||||||
|
|
||||||
if (empty($list)) {
|
if (empty($list)) {
|
||||||
// Fallback: aus DB/Redis (persistiert vom Job)
|
// Fallback: persistierter Wert aus DB/Redis
|
||||||
$list = \App\Support\Setting::get('woltguard.services', []);
|
$list = \App\Support\Setting::get('woltguard.services', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = [];
|
$rows = [];
|
||||||
if (is_array($list)) {
|
if (is_array($list)) {
|
||||||
// neues Format: ['ts'=>..., 'rows'=>[...]]
|
$rows = isset($list['rows']) && is_array($list['rows'])
|
||||||
if (isset($list['rows']) && is_array($list['rows'])) {
|
? $list['rows'] // neues Format
|
||||||
$rows = $list['rows'];
|
: (isset($list[0]) && is_array($list[0]) ? $list : []); // altes Format
|
||||||
}
|
|
||||||
// altes Format: direkt die Array-Liste
|
|
||||||
elseif (isset($list[0]) && is_array($list[0])) {
|
|
||||||
$rows = $list;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->services = $rows;
|
$this->services = $rows;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue