* (bug 8117) {{REVISIONTIMESTAMP}} showed weird default if $wgLocalTZoffset set;
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 2 Dec 2006 23:56:25 +0000 (23:56 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 2 Dec 2006 23:56:25 +0000 (23:56 +0000)
  now uses current time for previews and if timestamp can't be loaded from DB
* {{REVISIONTIMESTAMP}} now uses site local timezone instead of user timezone
  to ensure consistent behavior
* {{REVISIONTIMESTAMP}} and friends should now work on non-MySQL backends

RELEASE-NOTES
includes/Parser.php

index fd42dd6..f464313 100644 (file)
@@ -237,6 +237,12 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   broken proxies that mangle such characters in form submissions
 * (bug 7461) Allow overwriting pages using importTextFile.php
 * (bug 7946) importTextFile.php doesn't perform pre-save transform
+* (bug 8117) {{REVISIONTIMESTAMP}} showed weird default if $wgLocalTZoffset set;
+  now uses current time for previews and if timestamp can't be loaded from DB
+* {{REVISIONTIMESTAMP}} now uses site local timezone instead of user timezone
+  to ensure consistent behavior
+* {{REVISIONTIMESTAMP}} and friends should now work on non-MySQL backends
+
 
 == Languages updated ==
 
index ef298a3..4cf48e8 100644 (file)
@@ -4528,7 +4528,7 @@ class Parser
 
        /**
         * Get the timestamp associated with the current revision, adjusted for 
-        * the user's current timestamp
+        * the default server-local timestamp
         */
        function getRevisionTimestamp() {
                if ( is_null( $this->mRevisionTimestamp ) ) {
@@ -4537,8 +4537,21 @@ class Parser
                        $dbr =& wfGetDB( DB_SLAVE );
                        $timestamp = $dbr->selectField( 'revision', 'rev_timestamp',
                                        array( 'rev_id' => $this->mRevisionId ), __METHOD__ );
-                       $this->mRevisionTimestamp = $wgContLang->userAdjust( $timestamp );
-               
+                       
+                       // Normalize timestamp to internal MW format for timezone processing.
+                       // This has the added side-effect of replacing a null value with
+                       // the current time, which gives us more sensible behavior for
+                       // previews.
+                       $timestamp = wfTimestamp( TS_MW, $timestamp );
+                       
+                       // The cryptic '' timezone parameter tells to use the site-default
+                       // timezone offset instead of the user settings.
+                       //
+                       // Since this value will be saved into the parser cache, served
+                       // to other users, and potentially even used inside links and such,
+                       // it needs to be consistent for all visitors.
+                       $this->mRevisionTimestamp = $wgContLang->userAdjust( $timestamp, '' );
+                       
                        wfProfileOut( __METHOD__ );
                }
                return $this->mRevisionTimestamp;