Setting $wgLocalTZoffset based on $wgLocaltimezone, using code that used to
authorRob Lanphier <robla@users.mediawiki.org>
Sun, 15 May 2011 13:42:10 +0000 (13:42 +0000)
committerRob Lanphier <robla@users.mediawiki.org>
Sun, 15 May 2011 13:42:10 +0000 (13:42 +0000)
be in a comment in DefaultSettings.  Pair programmed with hashar.

includes/DefaultSettings.php
includes/Setup.php

index 1a4ef30..88d87e5 100644 (file)
@@ -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;
 
index 706155a..6bc49ea 100644 (file)
@@ -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;