querying date_default_timezone_get() only once and storing it as

$GLOBALS[egw_info][server][server_timezone], as it fills the log with
warnings under php5.3
This commit is contained in:
Ralf Becker 2009-11-30 15:57:17 +00:00
parent 8b59123838
commit 5db82f568d
2 changed files with 22 additions and 1 deletions

View File

@ -125,6 +125,19 @@ class egw extends egw_minimal
}
//$GLOBALS['egw_info']['server'] = config::read('phpgwapi'); would unserialize arrays
// 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']))
{
$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();
error_log(__METHOD__."() stored server_timezone=".date_default_timezone_get());
}
date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']);
// setup the other subclasses
$this->translation = new translation();
$this->common = new common();
@ -174,7 +187,12 @@ class egw extends egw_minimal
{
$this->db->Link_ID->SetCharSet($GLOBALS['egw_info']['server']['system_charset']);
}
// restoring server timezone, to avoid warnings under php5.3
if (empty($GLOBALS['egw_info']['server']['server_timezone']))
{
date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']);
}
register_shutdown_function(array($this, 'shutdown'));
$this->define_egw_constants();

View File

@ -228,6 +228,9 @@
$current_config['tz_offset'] = $datetime->getbestguess();
unset($datetime);
// storing default timezone as system timezone
$current_config['system_timezone'] = date_default_timezone_get();
// RalfBecker: php.net recommend this for security reasons, it should be our default too
$current_config['usecookies'] = 'True';