Let the plugin read partner vars from the same RAM cache bash reads, so PHP and bash cannot disagree about a partner

This commit is contained in:
Gmer4Lfe
2026-08-16 19:40:49 -04:00
parent 4f95cc6d13
commit 35e59d2510
8 changed files with 25 additions and 14 deletions
+12 -1
View File
@@ -729,8 +729,19 @@ function vv_disk_thresholds(): array {
// Results are cached in /tmp for 30 seconds so rapid monitor polls don't hammer remote hosts.
function vv_remote_hosts_stats(): array {
// Read ALL conf files — remote host keys live in their own host*.conf, not the current host's.
//
// The RAM cache is read first and wins, because it is the only current copy of a partner conf.
// conf_sync.sh pulls each partner's live conf into VV_CONF_RAM_CACHE_DIR; load_config.sh has
// sourced partner vars from there rather than from disk for as long as the cache has existed,
// but this glob never did — so PHP and bash could disagree about the same partner. Any
// host*.conf still sitting in CONF_DIR for a host that is not this one is a leftover from
// before sparse checkout, and is stale by definition.
$vars = vv_conf_vars();
foreach (glob(CONF_DIR . '/host*.conf') ?: [] as $f) {
$confFiles = array_merge(
glob(VV_CONF_RAM_CACHE_DIR . '/host*.conf') ?: [],
glob(CONF_DIR . '/host*.conf') ?: []
);
foreach ($confFiles as $f) {
$raw = file_get_contents($f) ?: '';
preg_match_all('/^\s*([A-Z0-9_]+)\s*=\s*["\']?([^"\'#\n]*?)["\']?\s*(?:#.*)?$/m', $raw, $m);
foreach ($m[1] as $i => $key) {