diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:47:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:47:35 +0000 |
commit | 5f112e7d0464d98282443b78870cdccabe42aae9 (patch) | |
tree | aac24e989ceebb84c04de382960608c3fcef7313 /library/X509/Command.php | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-x509-5f112e7d0464d98282443b78870cdccabe42aae9.tar.xz icingaweb2-module-x509-5f112e7d0464d98282443b78870cdccabe42aae9.zip |
Adding upstream version 1:1.1.2.upstream/1%1.1.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | library/X509/Command.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/library/X509/Command.php b/library/X509/Command.php new file mode 100644 index 0000000..7737119 --- /dev/null +++ b/library/X509/Command.php @@ -0,0 +1,35 @@ +<?php +// Icinga Web 2 X.509 Module | (c) 2018 Icinga GmbH | GPLv2 + +namespace Icinga\Module\X509; + +use Icinga\Application\Icinga; +use Icinga\Data\ResourceFactory; +use ipl\Sql; + +class Command extends \Icinga\Cli\Command +{ + // Fix Web 2 issue where $configs is not properly initialized + protected $configs = []; + + public function init() + { + Icinga::app()->getModuleManager()->loadEnabledModules(); + } + + /** + * Get the connection to the X.509 database + * + * @return Sql\Connection + */ + public function getDb() + { + $config = new Sql\Config(ResourceFactory::getResourceConfig( + $this->Config()->get('backend', 'resource') + )); + + $conn = new Sql\Connection($config); + + return $conn; + } +} |