From: Marcin Haba Date: Mon, 17 Apr 2023 07:49:28 +0000 (+0200) Subject: baculum: Improve precision in show command output parser X-Git-Tag: Release-13.0.3~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc748a67a25b95221eb58711dc17ad7639fbb387;p=thirdparty%2Fbacula.git baculum: Improve precision in show command output parser --- diff --git a/gui/baculum/protected/API/Modules/ConsoleOutputShowPage.php b/gui/baculum/protected/API/Modules/ConsoleOutputShowPage.php index a7e280568..6eb80d09c 100644 --- a/gui/baculum/protected/API/Modules/ConsoleOutputShowPage.php +++ b/gui/baculum/protected/API/Modules/ConsoleOutputShowPage.php @@ -75,11 +75,16 @@ abstract class ConsoleOutputShowPage extends ConsoleOutputPage { $ret = $part = []; $section = ''; for ($i = 0; $i < count($output); $i++) { - $scount = preg_match('/^[A-Za-z]+: name=.+/i', $output[$i], $match); + $scount = preg_match('/^[A-Za-z]+: name=.+/i', $output[$i]); $mcount = preg_match_all('/(?<=\s)\w+=.*?(?=\s+\w+=.*?|$)/i', $output[$i], $matches); + $acount = preg_match('/^\s+-->\s+(\w+):\s+name=(.+?)(?=\s+\w+=.+|$)/i', $output[$i], $match); if ($mcount == 0) { continue; } + if ($acount == 1) { + $key = strtolower($match[1]); + $part[$key] = $match[2]; + } for ($j = 0; $j < count($matches[0]); $j++) { list($key, $value) = explode('=', $matches[0][$j], 2); $key = strtolower($key);