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.
This commit is contained in:
Thomas Gelf 2014-06-20 12:54:37 +02:00
parent f498cd0c81
commit 559457f730
1 changed files with 5 additions and 1 deletions

View File

@ -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;