If enforcing a charset, DO IT ONLY IF THE DB TYPE IS CORRECT
This commit is contained in:
parent
1b2cd8fdf3
commit
0b6f71c446
|
@ -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')
|
||||||
));
|
));
|
||||||
$config->charset = 'utf8mb4';
|
if ($config->db === 'mysql') {
|
||||||
|
$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);
|
||||||
$resourceConfig->charset = 'utf8';
|
if ($resourceConfig->db === 'mysql') {
|
||||||
|
$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);
|
||||||
$resourceConfig->charset = 'utf8';
|
if ($resourceConfig->db === 'mysql') {
|
||||||
|
$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'));
|
||||||
$resourceConfig->charset = 'utf8';
|
if ($resourceConfig->db === 'mysql') {
|
||||||
|
$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);
|
||||||
$resourceConfig->charset = 'utf8';
|
if ($resourceConfig->db === 'mysql') {
|
||||||
|
$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);
|
||||||
$resourceConfig->charset = 'utf8';
|
if ($resourceConfig->db === 'mysql') {
|
||||||
|
$resourceConfig->charset = 'utf8';
|
||||||
|
}
|
||||||
|
|
||||||
/** @var DbConnection $conn */
|
/** @var DbConnection $conn */
|
||||||
$conn = ResourceFactory::createResource($resourceConfig);
|
$conn = ResourceFactory::createResource($resourceConfig);
|
||||||
|
|
Loading…
Reference in New Issue