From 559457f73088d88dd5c92f7326b68d2bfd66da37 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 20 Jun 2014 12:54:37 +0200 Subject: [PATCH] Bootstrap/timezone: do not enforce config The current way forces people running a correctly configured PHP to configure timezone once again in Icinga Web. We want LESS config, so this tries to fix this. --- library/Icinga/Application/ApplicationBootstrap.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Application/ApplicationBootstrap.php b/library/Icinga/Application/ApplicationBootstrap.php index 7e6fed800..38bb11981 100644 --- a/library/Icinga/Application/ApplicationBootstrap.php +++ b/library/Icinga/Application/ApplicationBootstrap.php @@ -457,7 +457,11 @@ abstract class ApplicationBootstrap */ protected function setupTimezone() { - $timeZoneString = $this->config->global !== null ? $this->config->global->get('timezone', 'UTC') : 'UTC'; + $default = @date_default_timezone_get(); + if (! $default) { + $default = 'UTC'; + } + $timeZoneString = $this->config->global !== null ? $this->config->global->get('timezone', $default) : $default; date_default_timezone_set($timeZoneString); DateTimeFactory::setConfig(array('timezone' => $timeZoneString)); return $this;