mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
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\Application\Logger;
|
||||||
use Icinga\Util\DateTimeFactory;
|
use Icinga\Util\DateTimeFactory;
|
||||||
use Icinga\Util\Translator;
|
use Icinga\Util\Translator;
|
||||||
|
use Icinga\Util\TimezoneDetect;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -441,7 +442,14 @@ abstract class ApplicationBootstrap
|
|||||||
*/
|
*/
|
||||||
protected function setupTimezone()
|
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) {
|
if (! $default) {
|
||||||
$default = 'UTC';
|
$default = 'UTC';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user