Do NOT store "System/Localtime" as server_timezone, as it is no valid timezone

This commit is contained in:
Ralf Becker 2010-03-15 07:53:12 +00:00
parent abd19f0f27
commit 9f3e658b1c
2 changed files with 24 additions and 10 deletions

View File

@ -129,14 +129,20 @@ class egw extends egw_minimal
// if no server timezone set, use date_default_timezone_get() to determine it once // if no server timezone set, use date_default_timezone_get() to determine it once
// it fills to log with deprecated warnings under 5.3 otherwise // it fills to log with deprecated warnings under 5.3 otherwise
if (empty($GLOBALS['egw_info']['server']['server_timezone'])) if (empty($GLOBALS['egw_info']['server']['server_timezone']) ||
$GLOBALS['egw_info']['server']['server_timezone'] == 'System/Localtime') // treat invalid tz like empty!
{ {
$config = new config('phpgwapi'); try
$config->read_repository(); {
$config->save_value('server_timezone', $tz = new DateTimeZone(date_default_timezone_get());
$GLOBALS['egw_info']['server']['server_timezone'] = date_default_timezone_get()); config::save_value('server_timezone',$GLOBALS['egw_info']['server']['server_timezone'] = $tz->getName(),'phpgwapi');
$config->save_repository(); error_log(__METHOD__."() stored server_timezone=".$GLOBALS['egw_info']['server']['server_timezone']);
error_log(__METHOD__."() stored server_timezone=".$GLOBALS['egw_info']['server']['server_timezone']); }
catch(Exception $e)
{
// do nothing if new DateTimeZone fails (eg. 'System/Localtime' returned), specially do NOT store it!
error_log(__METHOD__."() NO valid 'date.timezone' set in your php.ini!");
}
} }
date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']);

View File

@ -263,9 +263,17 @@ class setup_process
{ {
$current_config['system_charset'] = $GLOBALS['egw_setup']->system_charset; $current_config['system_charset'] = $GLOBALS['egw_setup']->system_charset;
} }
// storing default timezone as system timezone // storing default timezone as server timezone
$current_config['system_timezone'] = date_default_timezone_get(); try
{
$tz = new DateTimeZone(date_default_timezone_get());
$current_config['server_timezone'] = $tz->getName();
}
catch(Exception $e)
{
// do nothing if new DateTimeZone fails (eg. 'System/Localtime' returned), specially do NOT store it!
error_log(__METHOD__."() NO valid 'date.timezone' set in your php.ini!");
}
$current_config['install_id'] = md5($_SERVER['HTTP_HOST'].microtime(true).$GLOBALS['egw_setup']->ConfigDomain); $current_config['install_id'] = md5($_SERVER['HTTP_HOST'].microtime(true).$GLOBALS['egw_setup']->ConfigDomain);
$current_config['postpone_statistics_submit'] = time() + 2 * 30 * 3600; // ask user in 2 month from now, when he has something to report $current_config['postpone_statistics_submit'] = time() + 2 * 30 * 3600; // ask user in 2 month from now, when he has something to report