Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/02-Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 2 additions & 8 deletions library/Reporting/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Icinga\Application\Config;
use Icinga\Data\ResourceFactory;
use ipl\Sql;
use Pdo\Mysql;
use PDO;
use stdClass;

Expand Down Expand Up @@ -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'";
}

Expand Down
Loading