]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Make show command output parser more accurate
authorMarcin Haba <marcin.haba@bacula.pl>
Fri, 3 Feb 2023 09:46:30 +0000 (10:46 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sun, 5 Mar 2023 06:06:30 +0000 (07:06 +0100)
gui/baculum/protected/API/Modules/ConsoleOutputShowPage.php

index fe2526d6fcda27fd8876829dc50a4af71b55ae94..a7e280568ba7b49fe13d9174396574467c3b94a3 100644 (file)
@@ -40,6 +40,11 @@ abstract class ConsoleOutputShowPage extends ConsoleOutputPage {
        protected function parseOutput(array $output) {
                $ret = [];
                for ($i = 0; $i < count($output); $i++) {
+                       $acount = preg_match('/^\s+-->\s+(\w+):\s+name=(.+?)(?=\s+\w+=.+|$)/i', $output[$i], $match);
+                       if ($acount === 1) {
+                               $key = strtolower($match[1]);
+                               $ret[$key] = $match[2];
+                       }
                        $mcount = preg_match_all('/(?<=\s)\w+=.+?(?=\s+\w+=.+|$)/i', $output[$i], $matches);
                        if ($mcount === 0) {
                                continue;