From: Rob Lanphier Date: Sun, 15 May 2011 13:42:10 +0000 (+0000) Subject: Setting $wgLocalTZoffset based on $wgLocaltimezone, using code that used to X-Git-Tag: 1.31.0-rc.0~30150 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=c7999388a4432bf2f1540348a9d935a346e27d30;p=lhc%2Fweb%2Fwiklou.git Setting $wgLocalTZoffset based on $wgLocaltimezone, using code that used to be in a comment in DefaultSettings. Pair programmed with hashar. --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 1a4ef3097c..88d87e5631 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2110,17 +2110,7 @@ $wgLocaltimezone = null; * This setting is used for most date/time displays in the software, and is * overrideable in user preferences. It is *not* used for signature timestamps. * - * You can set it to match the configured server timezone like this: - * $wgLocalTZoffset = date("Z") / 60; - * - * If your server is not configured for the timezone you want, you can set - * this in conjunction with the signature timezone and override the PHP default - * timezone like so: - * $wgLocaltimezone="Europe/Berlin"; - * date_default_timezone_set( $wgLocaltimezone ); - * $wgLocalTZoffset = date("Z") / 60; - * - * Leave at NULL to show times in universal time (UTC/GMT). + * By default, this will be set to match $wgLocaltimezone. */ $wgLocalTZoffset = null; diff --git a/includes/Setup.php b/includes/Setup.php index 706155a2a9..6bc49ea2a8 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -346,9 +346,14 @@ wfMemoryLimit(); * explicitly set. Inspired by phpMyAdmin's treatment of the problem. */ wfSuppressWarnings(); -date_default_timezone_set( date_default_timezone_get() ); +if(!isset($wgLocaltimezone)) $wgLocaltimezone = date_default_timezone_get(); wfRestoreWarnings(); +date_default_timezone_set( $wgLocaltimezone ); +if(!isset($wgLocalTZoffset)) { + $wgLocalTZoffset = date('Z') / 60; +} + # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor $wgRequest = new WebRequest;