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:51:38 +00:00
parent 89f7d50cec
commit 7f3651e3f2
2 changed files with 25 additions and 11 deletions

View File

@ -135,15 +135,21 @@ class egw extends egw_minimal
// 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
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');
$config->read_repository();
$config->save_value('server_timezone',
$GLOBALS['egw_info']['server']['server_timezone'] = date_default_timezone_get());
$config->save_repository();
try
{
$tz = new DateTimeZone(date_default_timezone_get());
config::save_value('server_timezone',$GLOBALS['egw_info']['server']['server_timezone'] = $tz->getName(),'phpgwapi');
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']);
// setup the other subclasses

View File

@ -263,9 +263,17 @@ class setup_process
{
$current_config['system_charset'] = $GLOBALS['egw_setup']->system_charset;
}
// storing default timezone as system timezone
$current_config['system_timezone'] = date_default_timezone_get();
// storing default timezone as server timezone
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['postpone_statistics_submit'] = time() + 2 * 30 * 3600; // ask user in 2 month from now, when he has something to report