mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-30 11:03:21 +01:00
fix: suppress exec/shell_exec warnings and guard null references
DaemonTrait: added @ to shell_exec calls that may fail on restricted systems (e.g. when /proc is unavailable). ProcessManager::isNginxRunning(): suppressed exec warning when pgrep is not available. Database::query(): guarded explode on debugString output to prevent undefined offset when Sent SQL section is missing. UpdateCronJob: added null check for $gitRelease to prevent fatal error when GitHubReleases service fails to initialize.
This commit is contained in:
@@ -35,9 +35,9 @@ trait DaemonTrait {
|
||||
*/
|
||||
protected function killStaleProcesses(string $rPattern): void {
|
||||
$rPID = intval(getmypid());
|
||||
$rPids = trim(shell_exec('ps aux | grep ' . escapeshellarg($rPattern) . ' | grep -v grep | grep -v ' . $rPID . " | awk '{print \$2}'") ?? '');
|
||||
$rPids = trim(@shell_exec('ps aux | grep ' . escapeshellarg($rPattern) . ' | grep -v grep | grep -v ' . $rPID . " | awk '{print \$2}'") ?? '');
|
||||
if ($rPids !== '') {
|
||||
shell_exec('kill -9 ' . $rPids . ' > /dev/null 2>&1');
|
||||
@shell_exec('kill -9 ' . $rPids . ' > /dev/null 2>&1');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user