From d0c13510c5ef306e112a9ae735b51c1bad3eacc1 Mon Sep 17 00:00:00 2001 From: bergware Date: Thu, 24 Apr 2025 19:11:35 +0200 Subject: [PATCH] Revert "update diagnostics" This reverts commit b4542d9d2a957c52f43f99490ad72c5f3e8f4646. --- emhttp/plugins/dynamix/scripts/diagnostics | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/emhttp/plugins/dynamix/scripts/diagnostics b/emhttp/plugins/dynamix/scripts/diagnostics index 717f503d9..ffc58f2ab 100755 --- a/emhttp/plugins/dynamix/scripts/diagnostics +++ b/emhttp/plugins/dynamix/scripts/diagnostics @@ -26,7 +26,7 @@ $cli = empty($zip); $docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp'); require_once "$docroot/webGui/include/Helpers.php"; -require_once "$docroot/webGui/include/publish.php"; +require_once "$docroot/webGui/include/Wrappers.php"; if (is_file('/boot/syslinux/syslinux.cfg')) { $bootenv = '/boot/syslinux'; @@ -45,7 +45,18 @@ $pools = pools_filter($disks); require_once "$docroot/webGui/include/CustomMerge.php"; function write(...$messages){ - foreach ($messages as $message) publish('diagnostics', $message); + $com = curl_init(); + curl_setopt_array($com,[ + CURLOPT_URL => 'http://localhost/pub/diagnostics?buffer_length=1', + CURLOPT_UNIX_SOCKET_PATH => '/var/run/nginx.socket', + CURLOPT_POST => 1, + CURLOPT_RETURNTRANSFER => true + ]); + foreach ($messages as $message) { + curl_setopt($com, CURLOPT_POSTFIELDS, $message); + curl_exec($com); + } + curl_close($com); } // Modify run function to include error logging @@ -54,7 +65,7 @@ function run($cmd, &$save=null, $timeout=30) { // output command for display write($cmd); // execute command with timeout of 30s - exec("LC_ALL=en_US.UTF-8 timeout -s9 $timeout $cmd", $save); + exec("timeout -s9 $timeout $cmd", $save); return implode("\n",$save); } @@ -457,7 +468,7 @@ foreach ($ports as $port) { file_put_contents("/$diag/system/ethtool.txt", "--------------------------------\r\n", FILE_APPEND); } run("ip -br a|todos >".escapeshellarg("/$diag/system/ifconfig.txt")); -maskIP("/$diag/system/ifconfig.txt"); +if (!$all) maskIP("/$diag/system/ifconfig.txt"); // create system information (suppress errors) run("find /sys/kernel/iommu_groups/ -type l 2>/dev/null|sort -V|todos >".escapeshellarg("/$diag/system/iommu_groups.txt"));