[geeklog-cvs] geeklog: Keep track of the system time zone we set
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Nov 1 04:05:51 EST 2009
changeset 7431:ecdf072e268e
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/ecdf072e268e
user: Dirk Haun <dirk at haun-online.de>
date: Sun Sep 20 17:06:57 2009 +0200
description:
Keep track of the system time zone we set
diffstat:
system/classes/timezoneconfig.class.php | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
diffs (44 lines):
diff -r a053d9023368 -r ecdf072e268e system/classes/timezoneconfig.class.php
--- a/system/classes/timezoneconfig.class.php Sun Sep 20 13:37:16 2009 +0200
+++ b/system/classes/timezoneconfig.class.php Sun Sep 20 17:06:57 2009 +0200
@@ -55,23 +55,32 @@
{
global $_CONF;
+ static $system_timezone = '';
+
if (empty($tz) && !empty($_CONF['timezone'])) {
$tz = $_CONF['timezone'];
}
if (! empty($tz)) {
- if (function_exists('date_default_timezone_set')) {
- if (! @date_default_timezone_set($tz)) {
- date_default_timezone_set('UTC');
- COM_errorLog("Timezone '$tz' not valid - using 'UTC' instead", 1);
+ if ($tz != $system_timezone) {
+ if (function_exists('date_default_timezone_set')) {
+ if (! @date_default_timezone_set($tz)) {
+ date_default_timezone_set('UTC');
+ COM_errorLog("Timezone '$tz' not valid - using 'UTC' instead", 1);
+ $system_timezone = 'UTC';
+ } else {
+ $system_timezone = $tz;
+ }
+ } elseif (!ini_get('safe_mode') && function_exists('putenv')) {
+ // aka "Timezone Hack"
+ putenv('TZ=' . $tz);
+ $system_timezone = $tz;
}
- } elseif (!ini_get('safe_mode') && function_exists('putenv')) {
- // aka "Timezone Hack"
- putenv('TZ=' . $tz);
}
} elseif (function_exists('date_default_timezone_get')) {
// this is not ideal but will stop PHP 5.3.0ff from complaining ...
- date_default_timezone_set(@date_default_timezone_get());
+ $system_timezone = @date_default_timezone_get();
+ date_default_timezone_set($system_timezone);
}
}
More information about the geeklog-cvs
mailing list