mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-09-24 12:01:51 +02:00
refactor(streaming): remove dead code orphaned by the daemon cutover
Audited the streaming subsystem for symbols with zero real callers (ruled out dynamic dispatch: command-name strings, routes, #[ListensTo], self::/$this-> internal calls, bare-name string dispatch). Removals, each grep-verified across all of src/: - Whole class TS (src/Streaming/TimeshiftClient.php) — superseded by the inline TS byte-parsing in LLOD/Loopback; only ref left was a stale comment. Drops its 2 require + 3 use lines too. - StreamUtils::getTSInfo — 0 callers. - SegmentReader::getLLODSegments — replaced by the LLOD-v3 daemon feed; 0 callers. - ProcessChecker::isPIDRunning + isPIDsRunning (dead pair) — 0 callers; drops the now-orphaned CurlClient import. - ProcessManager: checkPidFile + matchesCmdline (dead pair), killByPattern, countProcesses, currentPid, releaseCronLock — all 0 callers (acquireCronLock stays; locks self-release on exit). - AsyncFileOperations: checkFilesExists, awaitFileExistsAdaptive, awaitFileModified, getCacheStats, filterExistingFiles — never-wired public helpers, 0 refs. php -l clean on all touched files; make gates green; no phpstan-baseline entries reference the removed symbols.
This commit is contained in:
@@ -164,52 +164,6 @@ class ProcessManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a process is alive using a PID file
|
||||
*
|
||||
* Reads PID from file, then checks /proc/PID/cmdline for expected string.
|
||||
*
|
||||
* @param string $pidFile Path to PID file
|
||||
* @param string $searchString Expected string in cmdline
|
||||
* @return bool
|
||||
*/
|
||||
public static function checkPidFile($pidFile, $searchString) {
|
||||
if (!file_exists($pidFile)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$pid = (int)trim(file_get_contents($pidFile));
|
||||
|
||||
if ($pid <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::matchesCmdline($pid, $searchString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a process cmdline contains a search string
|
||||
*
|
||||
* @param int $pid Process ID
|
||||
* @param string $search String to look for in cmdline
|
||||
* @return bool
|
||||
*/
|
||||
public static function matchesCmdline($pid, $search) {
|
||||
$pid = (int)$pid;
|
||||
|
||||
if ($pid <= 0 || !self::procExists($pid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cmdline = @file_get_contents('/proc/' . $pid . '/cmdline');
|
||||
|
||||
if ($cmdline === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return stripos($cmdline, $search) !== false;
|
||||
}
|
||||
|
||||
// ───────────────────────────────────────────────────────────
|
||||
// Process Control
|
||||
// ───────────────────────────────────────────────────────────
|
||||
@@ -235,25 +189,6 @@ class ProcessManager {
|
||||
return posix_kill($pid, $signal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Kill all processes matching a pattern via cmdline
|
||||
*
|
||||
* @param string $pattern Pattern to match in ps output
|
||||
*/
|
||||
public static function killByPattern($pattern) {
|
||||
$pattern = escapeshellarg($pattern);
|
||||
shell_exec("kill -9 `ps -ef | grep {$pattern} | grep -v grep | awk '{print \$2}'`");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current process PID
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function currentPid() {
|
||||
return getmypid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the age of a process in seconds (how long it has been running).
|
||||
*
|
||||
@@ -360,22 +295,6 @@ class ProcessManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Release a cron lock
|
||||
*
|
||||
* @param string $lockFile Path to PID lock file
|
||||
*/
|
||||
public static function releaseCronLock($lockFile) {
|
||||
if (file_exists($lockFile)) {
|
||||
$pid = (int)trim(file_get_contents($lockFile));
|
||||
|
||||
// Only remove if it's our lock
|
||||
if ($pid === getmypid()) {
|
||||
unlink($lockFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ───────────────────────────────────────────────────────────
|
||||
// Internal Helpers
|
||||
// ───────────────────────────────────────────────────────────
|
||||
@@ -512,17 +431,6 @@ class ProcessManager {
|
||||
// Utility
|
||||
// ───────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Count running processes matching a pattern
|
||||
*
|
||||
* @param string $pattern grep pattern
|
||||
* @return int
|
||||
*/
|
||||
public static function countProcesses($pattern) {
|
||||
$pattern = escapeshellarg($pattern);
|
||||
return (int)trim(shell_exec("ps ax | grep -v grep | grep -c {$pattern}"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an nginx master process is running.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user