From 15489dfcc98d7cb58a89da17b7b63b90cd1043b9 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 26 Oct 2023 13:37:51 +0200 Subject: [PATCH] DbCommand: support PHP 8.2 by not creating dynamic properties. --- .../db-init/application/clicommands/DbCommand.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/entrypoint/db-init/application/clicommands/DbCommand.php b/entrypoint/db-init/application/clicommands/DbCommand.php index 855036b..54443e3 100644 --- a/entrypoint/db-init/application/clicommands/DbCommand.php +++ b/entrypoint/db-init/application/clicommands/DbCommand.php @@ -47,16 +47,16 @@ class DbCommand extends Command public function initializedAction() { - echo (int) (array_search('icingaweb_group', $this->getDb()->listTables(), true) !== false); + echo (int) (array_search('icingaweb_group', $this->getDb()->conn->listTables(), true) !== false); } public function initAction() { $db = $this->getDb(); - $db->import( + $db->conn->import( Config::module('setup') - ->get('schema', 'path', Icinga::app()->getBaseDir('schema')) . "/{$db->dbType}.schema.sql" + ->get('schema', 'path', Icinga::app()->getBaseDir('schema')) . "/{$db->type}.schema.sql" ); } @@ -78,7 +78,7 @@ class DbCommand extends Command } /** - * @return DbTool + * @return \stdClass */ protected function getDb() { @@ -111,7 +111,10 @@ class DbCommand extends Command $db = new DbTool($config); $db->connectToDb(); - $db->dbType = $type; - return $db; + + return (object) [ + 'conn' => $db, + 'type' => $type + ]; } }