r100610 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100609‎ | r100610 | r100611 >
Date:16:14, 24 October 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
* (bug 31921) Fix for r78201: magic words REVISIONDAY, REVISIONMONTH and REVISIONYEAR now give current values on preview
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -113,6 +113,8 @@
114114 * (bug 31692) "summary" parameter now also work when undoing revisions
115115 * (bug 18823) "move succeeded" text displayed bluelinks even when redirect was
116116 suppressed
 117+* (bug 31921) Magic words REVISIONDAY, REVISIONMONTH and REVISIONYEAR now give
 118+ current values on preview
117119
118120 === API changes in 1.19 ===
119121 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
Index: trunk/phase3/includes/parser/Parser.php
@@ -5368,21 +5368,19 @@
53695369 if ( is_null( $this->mRevisionTimestamp ) ) {
53705370 wfProfileIn( __METHOD__ );
53715371
 5372+ global $wgContLang;
 5373+
53725374 $revObject = $this->getRevisionObject();
5373 - $timestamp = $revObject ? $revObject->getTimestamp() : false;
 5375+ $timestamp = $revObject ? $revObject->getTimestamp() : wfTimestampNow();
53745376
5375 - if( $timestamp !== false ) {
5376 - global $wgContLang;
 5377+ # The cryptic '' timezone parameter tells to use the site-default
 5378+ # timezone offset instead of the user settings.
 5379+ #
 5380+ # Since this value will be saved into the parser cache, served
 5381+ # to other users, and potentially even used inside links and such,
 5382+ # it needs to be consistent for all visitors.
 5383+ $this->mRevisionTimestamp = $wgContLang->userAdjust( $timestamp, '' );
53775384
5378 - # The cryptic '' timezone parameter tells to use the site-default
5379 - # timezone offset instead of the user settings.
5380 - #
5381 - # Since this value will be saved into the parser cache, served
5382 - # to other users, and potentially even used inside links and such,
5383 - # it needs to be consistent for all visitors.
5384 - $this->mRevisionTimestamp = $wgContLang->userAdjust( $timestamp, '' );
5385 - }
5386 -
53875385 wfProfileOut( __METHOD__ );
53885386 }
53895387 return $this->mRevisionTimestamp;

Follow-up revisions

RevisionCommit summaryAuthorDate
r107046MFT to REL1_18 r100610, bug 31921...hashar09:24, 22 December 2011
r107047remove bug 31921 from 1.19 RN...hashar09:25, 22 December 2011
r110101New extension that implements some preview related functions - {{#onpreview:p...bawolff05:19, 27 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78201* (bug 19006) {{REVISIONUSER}} no longer acts like {{CURRENTUSER}} in some cases...ialex18:17, 10 December 2010

Comments

#Comment by Dantman (talk | contribs)   03:10, 25 October 2011

Isn't returning blank on preview the defined behavior for these parser functions? In fact I could swear we have users relying on that fact in combination with parser functions to show things on preview, this would break that.

#Comment by Monty845 (talk | contribs)   16:05, 29 October 2011

The behavior recently changed, and is breaking a very large number of templates when previewed.

#Comment by Bawolff (talk | contribs)   05:32, 20 December 2011

Could we perhaps convince said people to start using {{REVISIONUSER}} instead. (yeah yeah, convincing wikipedians to change stuff is difficult)

#Comment by Bawolff (talk | contribs)   12:46, 10 January 2012

I was just thinking, since people want to do funky stuff on preview, and we can't stop them- Maybe we should just implement {{#ispreview:yes|no}}. After all we already record in parser options if its a preview, so it'd be very easy to implement.

#Comment by Hashar (talk | contribs)   22:19, 10 January 2012

> I was just thinking, since people want to do funky stuff on preview, and we can't stop them- Maybe we should just implement {{#ispreview:yes|no}}. After all we already record in parser options if its a preview, so it'd be very easy to implement.

Good idea! You might want to talk about it on wikitech-l or to some parser functions guru :-)

But please hold commit till 1.19 is branched :-b

#Comment by Bawolff (talk | contribs)   05:34, 27 January 2012

I made an experimental extension at extension:PreviewFunctions

#Comment by He7d3r (talk | contribs)   16:09, 10 November 2011
#Comment by 😂 (talk | contribs)   16:10, 10 November 2011

It wasn't merged as far as I can tell.

#Comment by He7d3r (talk | contribs)   16:14, 10 November 2011

Shouldn't it be tagged for wmf deployment? And for 1.18?

Besides, notice the inconsistency of REVISIONUSER on Preview x Special:ExpandTemplates in the example above

#Comment by Hashar (talk | contribs)   09:26, 22 December 2011

Merged in REL1_18 by r107046

Status & tagging log