From 8afbb7385d2494851202f7f33f96e222a28fc080 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 25 Jul 2024 09:43:38 +0200 Subject: [PATCH] DbResourcePage: Avoid showing a default charset for pgsql fixes #1035 --- library/Icingadb/Setup/DbResourcePage.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/library/Icingadb/Setup/DbResourcePage.php b/library/Icingadb/Setup/DbResourcePage.php index cc99dcc37..3c3cbf8d5 100644 --- a/library/Icingadb/Setup/DbResourcePage.php +++ b/library/Icingadb/Setup/DbResourcePage.php @@ -58,8 +58,27 @@ public function createElements(array $formData) ] ); + $charsetElement = $this->getElement('charset'); if (! isset($formData['db']) || $formData['db'] === 'mysql') { - $this->getElement('charset')->setValue('utf8mb4'); + $charsetElement->setValue('utf8mb4')->addDecorator( + ['preserveDefault' => 'HtmlTag'], + [ + 'tag' => 'input', + 'type' => 'hidden', + 'name' => 'charset' . static::DEFAULT_SUFFIX, + 'value' => 'utf8mb4' + ] + ); + } else { + $charsetElement->addDecorator( + ['preserveDefault' => 'HtmlTag'], + [ + 'tag' => 'input', + 'type' => 'hidden', + 'name' => 'charset' . static::DEFAULT_SUFFIX, + 'value' => '' + ] + ); } }