diff --git a/library/Icinga/Authentication/User/UserBackend.php b/library/Icinga/Authentication/User/UserBackend.php index 13e688795..826c56e7d 100644 --- a/library/Icinga/Authentication/User/UserBackend.php +++ b/library/Icinga/Authentication/User/UserBackend.php @@ -224,7 +224,7 @@ class UserBackend implements ConfigAwareFactory } $resourceConfig = ResourceFactory::getResourceConfig($backendConfig->resource); - if ($backendType === 'db') { + if ($backendType === 'db' && $resourceConfig->db === 'mysql') { $resourceConfig->charset = 'utf8'; } diff --git a/library/Icinga/Authentication/UserGroup/UserGroupBackend.php b/library/Icinga/Authentication/UserGroup/UserGroupBackend.php index 2a5948823..e73908739 100644 --- a/library/Icinga/Authentication/UserGroup/UserGroupBackend.php +++ b/library/Icinga/Authentication/UserGroup/UserGroupBackend.php @@ -166,7 +166,7 @@ class UserGroupBackend } $resourceConfig = ResourceFactory::getResourceConfig($backendConfig->resource); - if ($backendType === 'db') { + if ($backendType === 'db' && $resourceConfig->db === 'mysql') { $resourceConfig->charset = 'utf8'; } diff --git a/library/Icinga/Common/Database.php b/library/Icinga/Common/Database.php index fbe1e0260..4c977653c 100644 --- a/library/Icinga/Common/Database.php +++ b/library/Icinga/Common/Database.php @@ -31,7 +31,9 @@ trait Database $config = new SqlConfig(ResourceFactory::getResourceConfig( IcingaConfig::app()->get('global', 'config_resource') )); - $config->charset = 'utf8mb4'; + if ($config->db === 'mysql') { + $config->charset = 'utf8mb4'; + } $config->options = [PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ]; if ($config->db === 'mysql') { diff --git a/library/Icinga/User/Preferences/PreferencesStore.php b/library/Icinga/User/Preferences/PreferencesStore.php index b6d63a9ad..a084314e4 100644 --- a/library/Icinga/User/Preferences/PreferencesStore.php +++ b/library/Icinga/User/Preferences/PreferencesStore.php @@ -131,7 +131,9 @@ abstract class PreferencesStore $config->location = Config::resolvePath('preferences'); } elseif ($type === 'Db') { $resourceConfig = ResourceFactory::getResourceConfig($config->resource); - $resourceConfig->charset = 'utf8'; + if ($resourceConfig->db === 'mysql') { + $resourceConfig->charset = 'utf8'; + } $config->connection = ResourceFactory::createResource($resourceConfig); } diff --git a/modules/migrate/application/clicommands/PreferencesCommand.php b/modules/migrate/application/clicommands/PreferencesCommand.php index 63f4894be..a8bfc76be 100644 --- a/modules/migrate/application/clicommands/PreferencesCommand.php +++ b/modules/migrate/application/clicommands/PreferencesCommand.php @@ -37,7 +37,10 @@ class PreferencesCommand extends Command } $resourceConfig = ResourceFactory::getResourceConfig($resource); - $resourceConfig->charset = 'utf8'; + if ($resourceConfig->db === 'mysql') { + $resourceConfig->charset = 'utf8'; + } + $connection = ResourceFactory::createResource($resourceConfig); $preferencesPath = Config::resolvePath('preferences'); diff --git a/modules/migrate/library/Migrate/Config/UserDomainMigration.php b/modules/migrate/library/Migrate/Config/UserDomainMigration.php index 5edc93722..480f74648 100644 --- a/modules/migrate/library/Migrate/Config/UserDomainMigration.php +++ b/modules/migrate/library/Migrate/Config/UserDomainMigration.php @@ -207,7 +207,9 @@ class UserDomainMigration break; case 'db': $resourceConfig = ResourceFactory::getResourceConfig($config->get('global', 'config_resource')); - $resourceConfig->charset = 'utf8'; + if ($resourceConfig->db === 'mysql') { + $resourceConfig->charset = 'utf8'; + } /** @var DbConnection $conn */ $conn = ResourceFactory::createResource($resourceConfig); @@ -292,7 +294,9 @@ class UserDomainMigration } $resourceConfig = ResourceFactory::getResourceConfig($config->resource); - $resourceConfig->charset = 'utf8'; + if ($resourceConfig->db === 'mysql') { + $resourceConfig->charset = 'utf8'; + } /** @var DbConnection $conn */ $conn = ResourceFactory::createResource($resourceConfig); @@ -343,7 +347,9 @@ class UserDomainMigration } $resourceConfig = ResourceFactory::getResourceConfig($config->resource); - $resourceConfig->charset = 'utf8'; + if ($resourceConfig->db === 'mysql') { + $resourceConfig->charset = 'utf8'; + } /** @var DbConnection $conn */ $conn = ResourceFactory::createResource($resourceConfig);