Path: blob/master/src/applications/config/check/PhabricatorTimezoneSetupCheck.php
12256 views
<?php12final class PhabricatorTimezoneSetupCheck extends PhabricatorSetupCheck {34public function getDefaultGroup() {5return self::GROUP_OTHER;6}78protected function executeChecks() {9$php_value = ini_get('date.timezone');10if ($php_value) {11$old = date_default_timezone_get();12$ok = @date_default_timezone_set($php_value);13date_default_timezone_set($old);1415if (!$ok) {16$message = pht(17'Your PHP configuration selects an invalid timezone. '.18'Select a valid timezone.');1920$this21->newIssue('php.date.timezone')22->setShortName(pht('PHP Timezone'))23->setName(pht('PHP Timezone Invalid'))24->setMessage($message)25->addPHPConfig('date.timezone');26}27}2829$timezone = nonempty(30PhabricatorEnv::getEnvConfig('phabricator.timezone'),31ini_get('date.timezone'));32if ($timezone) {33return;34}3536$summary = pht(37'Without a configured timezone, PHP will emit warnings when working '.38'with dates, and dates and times may not display correctly.');3940$message = pht(41"Your configuration fails to specify a server timezone. You can either ".42"set the PHP configuration value '%s' or the %s configuration ".43"value '%s' to specify one.",44'date.timezone',45PlatformSymbols::getPlatformServerName(),46'phabricator.timezone');4748$this49->newIssue('config.timezone')50->setShortName(pht('Timezone'))51->setName(pht('Server Timezone Not Configured'))52->setSummary($summary)53->setMessage($message)54->addPHPConfig('date.timezone')55->addPhabricatorConfig('phabricator.timezone');56}57}585960