Put the media seed behind MEDIA_SEED_ENABLED so a partner filled by other means never starts a multi-week transfer
Tier 2 beside the per-orchestrator gates. Unset reads as on — the toggle postdates the seed.
This commit is contained in:
@@ -245,10 +245,22 @@ function vv_pt_remote_system(string $ip, string $sshKey): array {
|
||||
function vv_pt_media_seed(): array {
|
||||
$stat = '/var/log/varaverk/Rsync/media_seed.json';
|
||||
$log = '/var/log/varaverk/Rsync/media_seed.log';
|
||||
if (!is_file($stat)) return [];
|
||||
|
||||
// MEDIA_SEED_ENABLED is reported alongside the record rather than instead of it, because
|
||||
// the two answer different questions: the toggle says whether a seed may start, the record
|
||||
// says what the last one did. media_seed.sh exits 0 when the toggle is off — correct, it is
|
||||
// a decision and not a failure — so a record reading "ok" beside a disabled toggle would
|
||||
// otherwise render as "Seed complete" over a partner that was never seeded.
|
||||
//
|
||||
// Unset reads as enabled, matching media_seed.sh: the toggle postdates the script.
|
||||
$raw = vv_read_conf_raw('master.conf');
|
||||
$toggle = vv_arr_scalar($raw, 'MEDIA_SEED_ENABLED');
|
||||
$enabled = ($toggle === '' || strtolower($toggle) === 'true');
|
||||
|
||||
if (!is_file($stat)) return ['enabled' => $enabled];
|
||||
|
||||
$j = json_decode((string)file_get_contents($stat), true);
|
||||
if (!is_array($j)) return [];
|
||||
if (!is_array($j)) return ['enabled' => $enabled];
|
||||
|
||||
$status = (string)($j['status'] ?? '');
|
||||
$pid = (int)($j['pid'] ?? 0);
|
||||
@@ -280,11 +292,12 @@ function vv_pt_media_seed(): array {
|
||||
}
|
||||
|
||||
return array_filter([
|
||||
'status' => $status,
|
||||
'start' => isset($j['start']) ? (int)$j['start'] : null,
|
||||
'end' => isset($j['end']) ? (int)$j['end'] : null,
|
||||
'share' => $share,
|
||||
'line' => mb_substr($line, 0, 160),
|
||||
'enabled' => $enabled,
|
||||
'status' => $status,
|
||||
'start' => isset($j['start']) ? (int)$j['start'] : null,
|
||||
'end' => isset($j['end']) ? (int)$j['end'] : null,
|
||||
'share' => $share,
|
||||
'line' => mb_substr($line, 0, 160),
|
||||
], fn($v) => $v !== null && $v !== '');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user