CC-3955: System -> Preferences: Timezone setting is the first one in the list,
not the current (local) timezone - adding some code to validate the timezone that is parsed
This commit is contained in:
parent
31d643cee1
commit
63020cf288
|
@ -321,6 +321,10 @@ class AirtimeInstall
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
// we need to run php as commandline because we want to get the timezone in cli php.ini file
|
// we need to run php as commandline because we want to get the timezone in cli php.ini file
|
||||||
$defaultTimezone = exec("php -r 'echo date_default_timezone_get().PHP_EOL;'");
|
$defaultTimezone = exec("php -r 'echo date_default_timezone_get().PHP_EOL;'");
|
||||||
|
$defaultTimezone = trim($defaultTimezone);
|
||||||
|
if((!in_array($defaultTimezone, DateTimeZone::listIdentifiers()))){
|
||||||
|
$defaultTimezone = "UTC";
|
||||||
|
}
|
||||||
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', '$defaultTimezone')";
|
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', '$defaultTimezone')";
|
||||||
$result = $con->exec($sql);
|
$result = $con->exec($sql);
|
||||||
if ($result < 1) {
|
if ($result < 1) {
|
||||||
|
|
Loading…
Reference in New Issue