diff --git a/phpgwapi/inc/class.egw.inc.php b/phpgwapi/inc/class.egw.inc.php index fbca6b6a78..879c5e9a6c 100644 --- a/phpgwapi/inc/class.egw.inc.php +++ b/phpgwapi/inc/class.egw.inc.php @@ -127,11 +127,19 @@ class egw extends egw_minimal } //$GLOBALS['egw_info']['server'] = config::read('phpgwapi'); would unserialize arrays - // restoring server timezone, to avoid warnings under php5.3 - if (!empty($GLOBALS['egw_info']['server']['server_timezone'])) + // 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'])) { - date_default_timezone_set($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=".$GLOBALS['egw_info']['server']['server_timezone']); } + date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); + // setup the other subclasses // translation class is here only for backward compatibility, as all it's methods can be called static now $this->translation = new translation(); @@ -189,7 +197,7 @@ class egw extends egw_minimal { date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); } - + register_shutdown_function(array($this, 'shutdown')); $this->define_egw_constants(); diff --git a/phpgwapi/inc/class.egw_time.inc.php b/phpgwapi/inc/class.egw_time.inc.php index 85bdb89da7..a7933c8d4c 100644 --- a/phpgwapi/inc/class.egw_time.inc.php +++ b/phpgwapi/inc/class.egw_time.inc.php @@ -393,26 +393,11 @@ class egw_time extends DateTime */ public static function init() { - // 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 no server timezone set, use date_default_timezone_get() to determine it if (empty($GLOBALS['egw_info']['server']['server_timezone'])) { - $config = new config('phpgwapi'); - $config->read_repository(); - if ($config->config_data['server_timezone']) - { - $GLOBALS['egw_info']['server']['server_timezone'] = $config->config_data['server_timezone']; - } - else - { - $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()); - } + $GLOBALS['egw_info']['server']['server_timezone'] = date_default_timezone_get(); } - date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); - self::$server_timezone = new DateTimeZone($GLOBALS['egw_info']['server']['server_timezone']); if (isset($GLOBALS['egw_info']['user']['preferences']['common']['tz'])) {