[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/config/check/ -> PhabricatorSetupCheckTimezone.php (source)

   1  <?php
   2  
   3  final class PhabricatorSetupCheckTimezone extends PhabricatorSetupCheck {
   4  
   5    protected function executeChecks() {
   6      $php_value = ini_get('date.timezone');
   7      if ($php_value) {
   8        $old = date_default_timezone_get();
   9        $ok = @date_default_timezone_set($php_value);
  10        date_default_timezone_set($old);
  11  
  12        if (!$ok) {
  13          $message = pht(
  14            'Your PHP configuration configuration selects an invalid timezone. '.
  15            'Select a valid timezone.');
  16  
  17          $this
  18            ->newIssue('php.date.timezone')
  19            ->setShortName(pht('PHP Timezone'))
  20            ->setName(pht('PHP Timezone Invalid'))
  21            ->setMessage($message)
  22            ->addPHPConfig('date.timezone');
  23        }
  24      }
  25  
  26      $timezone = nonempty(
  27        PhabricatorEnv::getEnvConfig('phabricator.timezone'),
  28        ini_get('date.timezone'));
  29      if ($timezone) {
  30        return;
  31      }
  32  
  33      $summary = pht(
  34        'Without a configured timezone, PHP will emit warnings when working '.
  35        'with dates, and dates and times may not display correctly.');
  36  
  37      $message = pht(
  38        "Your configuration fails to specify a server timezone. You can either ".
  39        "set the PHP configuration value 'date.timezone' or the Phabricator ".
  40        "configuration value 'phabricator.timezone' to specify one.");
  41  
  42      $this
  43        ->newIssue('config.timezone')
  44        ->setShortName(pht('Timezone'))
  45        ->setName(pht('Server Timezone Not Configured'))
  46        ->setSummary($summary)
  47        ->setMessage($message)
  48        ->addPHPConfig('date.timezone')
  49        ->addPhabricatorConfig('phabricator.timezone');
  50    }
  51  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1