diff --git a/Plugin/unraid/api/rsync.php b/Plugin/unraid/api/rsync.php index 9c56291..9ffa0f7 100644 --- a/Plugin/unraid/api/rsync.php +++ b/Plugin/unraid/api/rsync.php @@ -143,10 +143,31 @@ $warnGb = (float)($vars['BANDWIDTH_WARN_GB'] ?? 50); $cutoff = date('Y-m-d', strtotime('-30 days')); $history = []; +// When rsync last actually moved anything, taken from the whole file rather than the window above. +// +// This is the only record of a transfer. last_sync is built from the orchestrators' run records, +// and those orchestrators do a great deal that is not rsync — git pull, permissions, cleaners, arr +// cleanup, docker updates — and run on their schedule whether or not RSYNC_ENABLED is true. So the +// page could report a healthy 56-minute "daily sync" for a subsystem that had not run in a month, +// which is exactly what it was doing: the last entry here is 2026-07-16, the day the global gate +// was closed for the HOST2 rebuild. +// +// Deliberately outside the 30-day cutoff. The last transfer is 29 days old as this is written and +// would have dropped out of the window within days, taking the page from a wrong answer to no +// answer — which on this question is not an improvement. +$lastTransfer = null; + if (file_exists($bwLog)) { foreach (file($bwLog, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [] as $line) { $p = explode('|', $line); if (count($p) < 5) continue; + // Recorded before the cutoff test, and unconditionally: the file is chronological, so the + // last line to pass the shape check is the most recent transfer however old it is. + $lastTransfer = [ + 'ts' => strtotime($p[0] . ' ' . $p[1]) ?: null, + 'profile' => $p[2], + 'status' => trim($p[4]), + ]; if ($p[0] < $cutoff) continue; $history[] = [ 'date' => $p[0], @@ -186,6 +207,7 @@ echo json_encode([ 'windows' => $base['windows'], 'active' => $base['active'], 'last_sync' => $base['last_sync'], + 'last_transfer' => $lastTransfer, 'bw_history' => $history, 'bw_warn_gb' => $warnGb, 'win_arrays' => $winArrays, diff --git a/Plugin/unraid/pages/rsync.php b/Plugin/unraid/pages/rsync.php index 7e29e42..1bff33f 100644 --- a/Plugin/unraid/pages/rsync.php +++ b/Plugin/unraid/pages/rsync.php @@ -37,6 +37,7 @@ // api/flag_toggle.php enable/disable toggles // api/confform.php inline conf edits require_once dirname(__DIR__) . '/include/confui.php'; +require_once dirname(__DIR__) . '/include/ai_chat.php'; ?>