Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/config/check/PhabricatorTimezoneSetupCheck.php
12256 views
1
<?php
2
3
final class PhabricatorTimezoneSetupCheck extends PhabricatorSetupCheck {
4
5
public function getDefaultGroup() {
6
return self::GROUP_OTHER;
7
}
8
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);
15
16
if (!$ok) {
17
$message = pht(
18
'Your PHP configuration selects an invalid timezone. '.
19
'Select a valid timezone.');
20
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');
27
}
28
}
29
30
$timezone = nonempty(
31
PhabricatorEnv::getEnvConfig('phabricator.timezone'),
32
ini_get('date.timezone'));
33
if ($timezone) {
34
return;
35
}
36
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.');
40
41
$message = pht(
42
"Your configuration fails to specify a server timezone. You can either ".
43
"set the PHP configuration value '%s' or the %s configuration ".
44
"value '%s' to specify one.",
45
'date.timezone',
46
PlatformSymbols::getPlatformServerName(),
47
'phabricator.timezone');
48
49
$this
50
->newIssue('config.timezone')
51
->setShortName(pht('Timezone'))
52
->setName(pht('Server Timezone Not Configured'))
53
->setSummary($summary)
54
->setMessage($message)
55
->addPHPConfig('date.timezone')
56
->addPhabricatorConfig('phabricator.timezone');
57
}
58
}
59
60