From: Brion Vibber Date: Sat, 2 Dec 2006 23:56:25 +0000 (+0000) Subject: * (bug 8117) {{REVISIONTIMESTAMP}} showed weird default if $wgLocalTZoffset set; X-Git-Tag: 1.31.0-rc.0~55007 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=8fc22c7ec62065b4086ce6f44baaa3dd93639cc6;p=lhc%2Fweb%2Fwiklou.git * (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 --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fd42dd68b8..f464313a5c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/Parser.php b/includes/Parser.php index ef298a3cec..4cf48e8eb9 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -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;