LoggingConfigForm: on Docker default to webserver log

(cherry picked from commit 3784fe80b77f52cf20b1e49c324cfa6ecb8fec33)
This commit is contained in:
Alexander A. Klimov 2023-01-23 15:13:46 +01:00 committed by Johannes Meyer
parent 59415e117f
commit fff795c6ab

View File

@ -30,6 +30,8 @@ class LoggingConfigForm extends Form
*/ */
public function createElements(array $formData) public function createElements(array $formData)
{ {
$defaultType = getenv('ICINGAWEB_OFFICIAL_DOCKER_IMAGE') ? 'php' : 'syslog';
$this->addElement( $this->addElement(
'select', 'select',
'logging_log', 'logging_log',
@ -38,6 +40,7 @@ class LoggingConfigForm extends Form
'autosubmit' => true, 'autosubmit' => true,
'label' => $this->translate('Logging Type'), 'label' => $this->translate('Logging Type'),
'description' => $this->translate('The type of logging to utilize.'), 'description' => $this->translate('The type of logging to utilize.'),
'value' => $defaultType,
'multiOptions' => array( 'multiOptions' => array(
'syslog' => 'Syslog', 'syslog' => 'Syslog',
'php' => $this->translate('Webserver Log', 'app.config.logging.type'), 'php' => $this->translate('Webserver Log', 'app.config.logging.type'),
@ -94,7 +97,7 @@ class LoggingConfigForm extends Form
) )
); );
if (! isset($formData['logging_log']) || $formData['logging_log'] === 'syslog') { if ((isset($formData['logging_log']) ? $formData['logging_log'] : $defaultType) === 'syslog') {
if (Platform::isWindows()) { if (Platform::isWindows()) {
/* @see https://secure.php.net/manual/en/function.openlog.php */ /* @see https://secure.php.net/manual/en/function.openlog.php */
$this->addElement( $this->addElement(