diff --git a/doc/02-Installation.md b/doc/02-Installation.md index 8b04fff5..c4bc7da1 100644 --- a/doc/02-Installation.md +++ b/doc/02-Installation.md @@ -10,7 +10,7 @@ Make sure you use `reporting` as the module name. The following requirements mus * MySQL or PostgreSQL PDO PHP libraries * The following PHP modules must be installed: `mbstring` * [Icinga Web](https://github.com/Icinga/icingaweb2) (≥2.9) -* [Icinga PHP Library (ipl)](https://github.com/Icinga/icinga-php-library) (≥0.13.0) +* [Icinga PHP Library (ipl)](https://github.com/Icinga/icinga-php-library) (≥0.19.0) * [Icinga PHP Thirdparty](https://github.com/Icinga/icinga-php-thirdparty) (≥0.12.0) ## Setting up the Database diff --git a/library/Reporting/Database.php b/library/Reporting/Database.php index fdd3df98..a96af16d 100644 --- a/library/Reporting/Database.php +++ b/library/Reporting/Database.php @@ -8,6 +8,7 @@ use Icinga\Application\Config; use Icinga\Data\ResourceFactory; use ipl\Sql; +use Pdo\Mysql; use PDO; use stdClass; @@ -44,14 +45,7 @@ private static function getDb(): RetryConnection $config->options = [PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ]; if ($config->db === 'mysql') { - // In PHP 8.5+, driver-specific constants of the PDO class are deprecated, - // but the replacements are only available since php 8.4 - if (version_compare(PHP_VERSION, '8.4.0', '<')) { - $mysqlAttrInitCommand = PDO::MYSQL_ATTR_INIT_COMMAND; - } else { - $mysqlAttrInitCommand = Pdo\Mysql::ATTR_INIT_COMMAND; - } - $config->options[$mysqlAttrInitCommand] = "SET SESSION SQL_MODE='STRICT_TRANS_TABLES" + $config->options[Mysql::ATTR_INIT_COMMAND] = "SET SESSION SQL_MODE='STRICT_TRANS_TABLES" . ",NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'"; }