Bug fixes, arr cleanup API-driven scan, shared JS formatters

Bug fixes:
- fallback.sh: escape sed metacharacters (\ & |) in state_set values
- common.sh: parse PID from lock file content correctly (handles pid:metadata format)
- unraid_api_key_renew.sh: fix path depth (../../../) and sync registry key to conf when stale
- stop.php: only clear pid/status if process is actually dead — D-state survives SIGKILL
- array_started.sh: check ARRAY_START_SCRIPTS empty before printing launch header

Arr cleanup:
- radarr_cleanup.sh / sonarr_cleanup.sh: fetch root folders from arr API instead of
  reverse-looking up the path map — handles multi-root-folder setups correctly

UI:
- varaverk.js: extract shared formatters (_relTime, _fmtBytes, _sz, _uptime, _gb, _tb, _n)
- arrs.php / partnership.php: use shared formatters, remove duplicates
- arrs.php / fallback.php: show error message on fetch failure instead of silent empty
- docker.php: disable rename input during request, restore original value on failure
- setup.php: abort controller timeout on detect fetch
- partnership.php: remove Re-run Phase 2 button opacity dimming
This commit is contained in:
Gmer4Lfe
2026-06-12 21:41:11 -04:00
parent 3937d5e33b
commit f10f09eeb1
13 changed files with 137 additions and 94 deletions
+7 -6
View File
@@ -76,16 +76,17 @@ if (file_exists($namedLock)) {
if (!in_array(basename($namedLock), $cleared)) $cleared[] = basename($namedLock);
}
// Update stat file
// Update stat file — only clear pid if actually dead (D-state processes survive SIGKILL)
$now = time();
$stat['status'] = 'stopped';
$stat['end'] = $now;
$stat['exit'] = -1;
unset($stat['pid']);
$stat['status'] = $dead ? 'stopped' : 'running';
$stat['end'] = $dead ? $now : ($stat['end'] ?? null);
$stat['exit'] = $dead ? -1 : ($stat['exit'] ?? null);
if ($dead) unset($stat['pid']);
file_put_contents($statFile, json_encode($stat));
echo json_encode([
'ok' => true,
'ok' => $dead,
'killed' => $dead,
'locks' => $cleared,
'error' => $dead ? null : 'Process still alive after SIGKILL (D-state) — lock may persist',
]);