From: Marcin Haba Date: Mon, 12 Aug 2019 04:39:12 +0000 (+0200) Subject: baculum: Don not use data description and data dependencies modules initialization X-Git-Tag: Release-9.6.0~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be0a1b6143b20853dabc7369eecd729e1ae508b3;p=thirdparty%2Fbacula.git baculum: Don not use data description and data dependencies modules initialization --- diff --git a/gui/baculum/protected/Web/Class/DataDependencies.php b/gui/baculum/protected/Web/Class/DataDependencies.php index 4f59f50bb..4c11fd4a3 100644 --- a/gui/baculum/protected/Web/Class/DataDependencies.php +++ b/gui/baculum/protected/Web/Class/DataDependencies.php @@ -3,7 +3,7 @@ * Bacula(R) - The Network Backup Solution * Baculum - Bacula web interface * - * Copyright (C) 2013-2017 Kern Sibbald + * Copyright (C) 2013-2019 Kern Sibbald * * The main author of Baculum is Marcin Haba. * The original author of Bacula is Kern Sibbald, with contributions @@ -32,11 +32,13 @@ class DataDependencies extends WebModule { */ const DATA_DEPS_FILE = 'Application.Web.Data.data_deps'; - private $data_deps; + private static $data_deps = null; - public function init($config) { - parent::init($config); - $this->data_deps = $this->loadDataDependencies(); + private function getDataDeps() { + if (is_null(self::$data_deps)) { + self::$data_deps = $this->loadDataDependencies(); + } + return self::$data_deps; } /** @@ -72,8 +74,9 @@ class DataDependencies extends WebModule { */ private function getDependencies($component_type, $resource_type) { $deps = null; - if (isset($this->data_deps->{$component_type}->{$resource_type})) { - $deps = (array)$this->data_deps->{$component_type}->{$resource_type}; + $data_deps = $this->getDataDeps(); + if (isset($data_deps->{$component_type}->{$resource_type})) { + $deps = (array)$data_deps->{$component_type}->{$resource_type}; } return $deps; } diff --git a/gui/baculum/protected/Web/Class/DataDescription.php b/gui/baculum/protected/Web/Class/DataDescription.php index 3bb93d087..31006a6fa 100644 --- a/gui/baculum/protected/Web/Class/DataDescription.php +++ b/gui/baculum/protected/Web/Class/DataDescription.php @@ -3,7 +3,7 @@ * Bacula(R) - The Network Backup Solution * Baculum - Bacula web interface * - * Copyright (C) 2013-2016 Kern Sibbald + * Copyright (C) 2013-2019 Kern Sibbald * * The main author of Baculum is Marcin Haba. * The original author of Bacula is Kern Sibbald, with contributions @@ -29,11 +29,13 @@ class DataDescription extends WebModule { */ const DATA_DESC_FILE = 'Application.Web.Data.data_desc'; - private $data_desc; + private static $data_desc = null; - public function init($config) { - parent::init($config); - $this->data_desc = $this->loadDataDescription(); + private function getDataDesc() { + if (is_null(self::$data_desc)) { + self::$data_desc = $this->loadDataDescription(); + } + return self::$data_desc; } private function loadDataDescription() { @@ -48,12 +50,14 @@ class DataDescription extends WebModule { public function getDescription($component_type, $resource_type, $directive_name = null) { $desc = null; - if (!is_null($directive_name) && isset($this->data_desc->{$component_type}->{$resource_type}->{$directive_name})) { - $desc = $this->data_desc->{$component_type}->{$resource_type}->{$directive_name}; - } elseif (isset($this->data_desc->{$component_type}->{$resource_type})) { - $desc = (array)$this->data_desc->{$component_type}->{$resource_type}; + $data_desc = $this->getDataDesc(); + if (!is_null($directive_name) && isset($data_desc->{$component_type}->{$resource_type}->{$directive_name})) { + $desc = $data_desc->{$component_type}->{$resource_type}->{$directive_name}; + } elseif (isset($data_desc->{$component_type}->{$resource_type})) { + $desc = (array)$data_desc->{$component_type}->{$resource_type}; } return $desc; } + } ?>