Mark watchdog list entries that name a container which no longer exists

Half the hard-pressure stop list is containers that are not installed, so at
level 3 it sheds half the memory the card implies. Badged on the lists where a
dead entry costs something and deliberately not on Scan ignore, where ignoring
something already gone is the point — a card of dashed pills by design would
teach the eye to skip the badge where it has to be believed.
This commit is contained in:
Gmer4Lfe
2026-08-14 16:06:02 -04:00
parent 2f8b7276a4
commit a7387c27fb
2 changed files with 88 additions and 10 deletions
+16
View File
@@ -68,6 +68,22 @@ require_once __DIR__ . '/partnership.php';
// until it doesn't and fails silently in the direction of hiding a real strike.
const VV_WD_SYS_BOOKKEEPING = ['watchdog_cycle'];
// Every container that exists on this host, running or not, for deciding whether a name in a
// watchdog list still refers to anything.
//
// `docker ps -a` rather than vv_docker_containers() + vv_docker_stopped(): those two are filtered
// by status and between them still miss states like restarting, and a container this page called
// "not installed" because it happened to be mid-restart would be worse than not checking at all.
// The whole point of the badge is that it is only ever shown when it is certainly true.
//
// Returns an empty array when docker cannot be reached, and callers must treat that as "unknown"
// rather than "nothing is installed" — otherwise a docker outage marks every entry dead.
function vv_wd_installed_containers(): array {
@exec("docker ps -a --format '{{.Names}}' 2>/dev/null", $out, $rc);
if ($rc !== 0) return [];
return array_values(array_filter(array_map('trim', $out), fn($n) => $n !== ''));
}
// ── Conf array parser (bash arrays) ──────────────────────────────────────────
function vv_wd_bash_array(string $raw, string $varname): array {