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:
Divarion-D
2026-03-15 12:23:08 +03:00
parent cf70d1c495
commit 4cf4c3a82d
4 changed files with 10 additions and 4 deletions
+2 -2
View File
@@ -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');
}
}