Add timezone detection to `setupTimezone' in ApplicationBootstrap

This commit is contained in:
Alexander Fuhr 2014-11-12 12:13:46 +01:00
parent 8d4e56a1fe
commit 8d120762de
1 changed files with 9 additions and 1 deletions

View File

@ -14,6 +14,7 @@ use Icinga\Exception\NotReadableError;
use Icinga\Application\Logger;
use Icinga\Util\DateTimeFactory;
use Icinga\Util\Translator;
use Icinga\Util\TimezoneDetect;
use Icinga\Exception\IcingaException;
/**
@ -441,7 +442,14 @@ abstract class ApplicationBootstrap
*/
protected function setupTimezone()
{
$detect = new TimezoneDetect();
if ($detect->success()) {
$default = $detect->getTimezoneName();
} else {
$default = @date_default_timezone_get();
}
if (! $default) {
$default = 'UTC';
}