]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Fix PHP error on storage view page with autochanger comming from host differ...
authorMarcin Haba <marcin.haba@bacula.pl>
Tue, 3 Dec 2019 04:52:58 +0000 (05:52 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 14 Dec 2019 15:02:17 +0000 (16:02 +0100)
gui/baculum/protected/Web/Pages/StorageView.php

index c6d3f4c93590cf1b65d2cff51d31dedc2f675b47..3ae56d85fa3c2903faa2671edc7be6884775927c 100644 (file)
@@ -90,6 +90,15 @@ class StorageView extends BaculumWebPage {
        public function setDevices() {
                $devices = array();
                if ($this->getIsAutochanger() && !empty($_SESSION['sd'])) {
+                       /**
+                        * NOTE: Here is called only Main API host. For storage daemons
+                        * on other hosts it can cause a problem. So far, there
+                        * is no 100% way to unambiguously determine basing on storage daemon
+                        * configuration if autochanger comes from Main or from other API host.
+                        * The problem will be if on Main host is defined autochanger
+                        * with the same name as autochanger from requested Storage here.
+                        * @TODO: Find a way to solve it.
+                        */
                        $result = $this->Application->getModule('api')->get(
                                array(
                                        'config',
@@ -98,7 +107,7 @@ class StorageView extends BaculumWebPage {
                                        $this->getDeviceName()
                                )
                        );
-                       if ($result->error === 0) {
+                       if ($result->error === 0 && is_object($result->output)) {
                                $devices = $result->output->Device;
                        }
                } else {