Add timezone detection to `setupTimezone' in ApplicationBootstrap
This commit is contained in:
parent
8d4e56a1fe
commit
8d120762de
|
@ -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()
|
||||
{
|
||||
$default = @date_default_timezone_get();
|
||||
$detect = new TimezoneDetect();
|
||||
|
||||
if ($detect->success()) {
|
||||
$default = $detect->getTimezoneName();
|
||||
} else {
|
||||
$default = @date_default_timezone_get();
|
||||
}
|
||||
|
||||
if (! $default) {
|
||||
$default = 'UTC';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue