mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
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:
parent
38fcc8a001
commit
fd0bfe97ea
@ -46,7 +46,7 @@ class egw_time extends DateTime
|
|||||||
*/
|
*/
|
||||||
const DATABASE = 'Y-m-d H:i:s';
|
const DATABASE = 'Y-m-d H:i:s';
|
||||||
/**
|
/**
|
||||||
* DateTimeZone of server, read via date_default_timezone_get(), set by self::init()
|
* DateTimeZone of server, read from $GLOBALS['egw_info']['server']['server_timezone'], set by self::init()
|
||||||
*
|
*
|
||||||
* @var DateTimeZone
|
* @var DateTimeZone
|
||||||
*/
|
*/
|
||||||
@ -393,7 +393,19 @@ class egw_time extends DateTime
|
|||||||
*/
|
*/
|
||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
self::$server_timezone = new DateTimeZone(date_default_timezone_get());
|
// 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->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']);
|
||||||
|
|
||||||
|
self::$server_timezone = new DateTimeZone($GLOBALS['egw_info']['server']['server_timezone']);
|
||||||
if (isset($GLOBALS['egw_info']['user']['preferences']['common']['tz']))
|
if (isset($GLOBALS['egw_info']['user']['preferences']['common']['tz']))
|
||||||
{
|
{
|
||||||
self::setUserPrefs($GLOBALS['egw_info']['user']['preferences']['common']['tz'],
|
self::setUserPrefs($GLOBALS['egw_info']['user']['preferences']['common']['tz'],
|
||||||
@ -517,7 +529,7 @@ class egw_time extends DateTime
|
|||||||
}
|
}
|
||||||
if (!$user_tzs) // if we have no user timezones, eg. user set no pref --> use server default
|
if (!$user_tzs) // if we have no user timezones, eg. user set no pref --> use server default
|
||||||
{
|
{
|
||||||
$user_tzs = array(date_default_timezone_get());
|
$user_tzs = array($GLOBALS['egw_info']['server']['sever_timezone']);
|
||||||
}
|
}
|
||||||
if ($extra && !in_array($extra,$user_tzs))
|
if ($extra && !in_array($extra,$user_tzs))
|
||||||
{
|
{
|
||||||
|
@ -256,6 +256,8 @@ 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
|
||||||
|
$current_config['system_timezone'] = date_default_timezone_get();
|
||||||
|
|
||||||
$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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user