DbCommand: support PHP 8.2

by not creating dynamic properties.
This commit is contained in:
Alexander A. Klimov 2023-10-26 13:37:51 +02:00
parent d07b4af99f
commit 15489dfcc9

View File

@ -47,16 +47,16 @@ class DbCommand extends Command
public function initializedAction() 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() public function initAction()
{ {
$db = $this->getDb(); $db = $this->getDb();
$db->import( $db->conn->import(
Config::module('setup') 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() protected function getDb()
{ {
@ -111,7 +111,10 @@ class DbCommand extends Command
$db = new DbTool($config); $db = new DbTool($config);
$db->connectToDb(); $db->connectToDb();
$db->dbType = $type;
return $db; return (object) [
'conn' => $db,
'type' => $type
];
} }
} }