mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 23:34:08 +02:00
Merge pull request #4491 from Icinga/fix/mysql-charset-usage-on-postgres-dbs-4490
If enforcing a charset, DO IT ONLY IF THE DB TYPE IS CORRECT
This commit is contained in:
commit
022c7da404
@ -224,7 +224,7 @@ class UserBackend implements ConfigAwareFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
$resourceConfig = ResourceFactory::getResourceConfig($backendConfig->resource);
|
$resourceConfig = ResourceFactory::getResourceConfig($backendConfig->resource);
|
||||||
if ($backendType === 'db') {
|
if ($backendType === 'db' && $resourceConfig->db === 'mysql') {
|
||||||
$resourceConfig->charset = 'utf8';
|
$resourceConfig->charset = 'utf8';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ class UserGroupBackend
|
|||||||
}
|
}
|
||||||
|
|
||||||
$resourceConfig = ResourceFactory::getResourceConfig($backendConfig->resource);
|
$resourceConfig = ResourceFactory::getResourceConfig($backendConfig->resource);
|
||||||
if ($backendType === 'db') {
|
if ($backendType === 'db' && $resourceConfig->db === 'mysql') {
|
||||||
$resourceConfig->charset = 'utf8';
|
$resourceConfig->charset = 'utf8';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,9 @@ trait Database
|
|||||||
$config = new SqlConfig(ResourceFactory::getResourceConfig(
|
$config = new SqlConfig(ResourceFactory::getResourceConfig(
|
||||||
IcingaConfig::app()->get('global', 'config_resource')
|
IcingaConfig::app()->get('global', 'config_resource')
|
||||||
));
|
));
|
||||||
|
if ($config->db === 'mysql') {
|
||||||
$config->charset = 'utf8mb4';
|
$config->charset = 'utf8mb4';
|
||||||
|
}
|
||||||
|
|
||||||
$config->options = [PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ];
|
$config->options = [PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ];
|
||||||
if ($config->db === 'mysql') {
|
if ($config->db === 'mysql') {
|
||||||
|
@ -131,7 +131,9 @@ abstract class PreferencesStore
|
|||||||
$config->location = Config::resolvePath('preferences');
|
$config->location = Config::resolvePath('preferences');
|
||||||
} elseif ($type === 'Db') {
|
} elseif ($type === 'Db') {
|
||||||
$resourceConfig = ResourceFactory::getResourceConfig($config->resource);
|
$resourceConfig = ResourceFactory::getResourceConfig($config->resource);
|
||||||
|
if ($resourceConfig->db === 'mysql') {
|
||||||
$resourceConfig->charset = 'utf8';
|
$resourceConfig->charset = 'utf8';
|
||||||
|
}
|
||||||
|
|
||||||
$config->connection = ResourceFactory::createResource($resourceConfig);
|
$config->connection = ResourceFactory::createResource($resourceConfig);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,10 @@ class PreferencesCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$resourceConfig = ResourceFactory::getResourceConfig($resource);
|
$resourceConfig = ResourceFactory::getResourceConfig($resource);
|
||||||
|
if ($resourceConfig->db === 'mysql') {
|
||||||
$resourceConfig->charset = 'utf8';
|
$resourceConfig->charset = 'utf8';
|
||||||
|
}
|
||||||
|
|
||||||
$connection = ResourceFactory::createResource($resourceConfig);
|
$connection = ResourceFactory::createResource($resourceConfig);
|
||||||
|
|
||||||
$preferencesPath = Config::resolvePath('preferences');
|
$preferencesPath = Config::resolvePath('preferences');
|
||||||
|
@ -207,7 +207,9 @@ class UserDomainMigration
|
|||||||
break;
|
break;
|
||||||
case 'db':
|
case 'db':
|
||||||
$resourceConfig = ResourceFactory::getResourceConfig($config->get('global', 'config_resource'));
|
$resourceConfig = ResourceFactory::getResourceConfig($config->get('global', 'config_resource'));
|
||||||
|
if ($resourceConfig->db === 'mysql') {
|
||||||
$resourceConfig->charset = 'utf8';
|
$resourceConfig->charset = 'utf8';
|
||||||
|
}
|
||||||
|
|
||||||
/** @var DbConnection $conn */
|
/** @var DbConnection $conn */
|
||||||
$conn = ResourceFactory::createResource($resourceConfig);
|
$conn = ResourceFactory::createResource($resourceConfig);
|
||||||
@ -292,7 +294,9 @@ class UserDomainMigration
|
|||||||
}
|
}
|
||||||
|
|
||||||
$resourceConfig = ResourceFactory::getResourceConfig($config->resource);
|
$resourceConfig = ResourceFactory::getResourceConfig($config->resource);
|
||||||
|
if ($resourceConfig->db === 'mysql') {
|
||||||
$resourceConfig->charset = 'utf8';
|
$resourceConfig->charset = 'utf8';
|
||||||
|
}
|
||||||
|
|
||||||
/** @var DbConnection $conn */
|
/** @var DbConnection $conn */
|
||||||
$conn = ResourceFactory::createResource($resourceConfig);
|
$conn = ResourceFactory::createResource($resourceConfig);
|
||||||
@ -343,7 +347,9 @@ class UserDomainMigration
|
|||||||
}
|
}
|
||||||
|
|
||||||
$resourceConfig = ResourceFactory::getResourceConfig($config->resource);
|
$resourceConfig = ResourceFactory::getResourceConfig($config->resource);
|
||||||
|
if ($resourceConfig->db === 'mysql') {
|
||||||
$resourceConfig->charset = 'utf8';
|
$resourceConfig->charset = 'utf8';
|
||||||
|
}
|
||||||
|
|
||||||
/** @var DbConnection $conn */
|
/** @var DbConnection $conn */
|
||||||
$conn = ResourceFactory::createResource($resourceConfig);
|
$conn = ResourceFactory::createResource($resourceConfig);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user