Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / config / check / PhabricatorTimezoneSetupCheck.php
blob08f6a28d10586c13d2866fbbcfa0deb78c78ba85
1 <?php
3 final class PhabricatorTimezoneSetupCheck extends PhabricatorSetupCheck {
5 public function getDefaultGroup() {
6 return self::GROUP_OTHER;
9 protected function executeChecks() {
10 $php_value = ini_get('date.timezone');
11 if ($php_value) {
12 $old = date_default_timezone_get();
13 $ok = @date_default_timezone_set($php_value);
14 date_default_timezone_set($old);
16 if (!$ok) {
17 $message = pht(
18 'Your PHP configuration selects an invalid timezone. '.
19 'Select a valid timezone.');
21 $this
22 ->newIssue('php.date.timezone')
23 ->setShortName(pht('PHP Timezone'))
24 ->setName(pht('PHP Timezone Invalid'))
25 ->setMessage($message)
26 ->addPHPConfig('date.timezone');
30 $timezone = nonempty(
31 PhabricatorEnv::getEnvConfig('phabricator.timezone'),
32 ini_get('date.timezone'));
33 if ($timezone) {
34 return;
37 $summary = pht(
38 'Without a configured timezone, PHP will emit warnings when working '.
39 'with dates, and dates and times may not display correctly.');
41 $message = pht(
42 "Your configuration fails to specify a server timezone. You can either ".
43 "set the PHP configuration value '%s' or the Phabricator ".
44 "configuration value '%s' to specify one.",
45 'date.timezone',
46 'phabricator.timezone');
48 $this
49 ->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');