r66200 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66199‎ | r66200 | r66201 >
Date:16:24, 11 May 2010
Author:mgrabovsky
Status:ok (Comments)
Tags:
Comment:
(bug 23426) The {{REVISIONMONTH}} variable is now zero-padded and added new variable {{REVISIONMONTH1}} when unpadded version is needed.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/MagicWord.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES
@@ -160,6 +160,8 @@
161161 * (bug 23422) mp3 files can now be moved
162162 * (bug 23448) MediaWiki:Summary-preview is now displayed instead of
163163 MediaWiki:Subject-preview when previewing summary
 164+* (bug 23426) The {{REVISIONMONTH}} variable is now zero-padded and added new
 165+ variable {{REVISIONMONTH1}} when unpadded version is needed.
164166
165167 === API changes in 1.17 ===
166168 * (bug 22738) Allow filtering by action type on query=logevent
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -311,6 +311,7 @@
312312 'revisionday' => array( 1, 'REVISIONDAY' ),
313313 'revisionday2' => array( 1, 'REVISIONDAY2' ),
314314 'revisionmonth' => array( 1, 'REVISIONMONTH' ),
 315+ 'revisionmonth1' => array( 1, 'REVISIONMONTH1' ),
315316 'revisionyear' => array( 1, 'REVISIONYEAR' ),
316317 'revisiontimestamp' => array( 1, 'REVISIONTIMESTAMP' ),
317318 'revisionuser' => array( 1, 'REVISIONUSER' ),
Index: trunk/phase3/includes/parser/Parser.php
@@ -2528,6 +2528,13 @@
25292529 # *after* a revision ID has been assigned. This is for null edits.
25302530 $this->mOutput->setFlag( 'vary-revision' );
25312531 wfDebug( __METHOD__ . ": {{REVISIONMONTH}} used, setting vary-revision...\n" );
 2532+ $value = substr( $this->getRevisionTimestamp(), 4, 2 );
 2533+ break;
 2534+ case 'revisionmonth1':
 2535+ # Let the edit saving system know we should parse the page
 2536+ # *after* a revision ID has been assigned. This is for null edits.
 2537+ $this->mOutput->setFlag( 'vary-revision' );
 2538+ wfDebug( __METHOD__ . ": {{REVISIONMONTH1}} used, setting vary-revision...\n" );
25322539 $value = intval( substr( $this->getRevisionTimestamp(), 4, 2 ) );
25332540 break;
25342541 case 'revisionyear':
Index: trunk/phase3/includes/MagicWord.php
@@ -79,6 +79,7 @@
8080 'revisionday',
8181 'revisionday2',
8282 'revisionmonth',
 83+ 'revisionmonth1',
8384 'revisionyear',
8485 'revisiontimestamp',
8586 'revisionuser',

Follow-up revisions

RevisionCommit summaryAuthorDate
r81414Test suite for revisions and date related magic variables....hashar21:04, 2 February 2011

Comments

#Comment by Raymond (talk | contribs)   18:29, 11 May 2010

Wouldn't it be more consistent to name them:

  • {{REVISIONMONTH}} = unpadded (unchanged behaviour)
  • {{REVISIONMONTH2}} = zero-padded

like we already have:

  • {{REVISIONDAY}} = 7 = unpadded
  • {{REVISIONDAY2}} = 07 = zero-padded
#Comment by Matěj Grabovský (talk | contribs)   18:43, 11 May 2010

Actually the current consistency is that month is zero-padded by default and day is unpadded by default.

See

  • CURRENTMONTH, LOCALMONTH – zero-padded
  • CURRENTMONTH1, LOCALMONTH1 – unpadded

and

  • CURRENTDAY, LOCALDAY – unpadded
  • CURRENTDAY2, LOCALDAY2 – zero-padded

If we do the proposed change with REVISIONMONTH we should also do this CURRENT/LOCALMONTH.

#Comment by Hashar (talk | contribs)   22:13, 7 December 2010

Subscribing to this revision notification. I am writing unit tests for this.

#Comment by Reedy (talk | contribs)   03:15, 6 January 2011

Ping

#Comment by Hashar (talk | contribs)   07:38, 6 January 2011

I am still working on the tests although I did not made any progress with the Xmas break ;-b

#Comment by Hashar (talk | contribs)   21:05, 2 February 2011

test suite with r81414. Still need to decide what we want to do.

#Comment by 😂 (talk | contribs)   22:59, 15 April 2011

Can we please just decide something? This has been sitting here for almost a year now. One way or the other, pick one.

Ping Raymond, Matěj, Hashar, please.

#Comment by Bryan (talk | contribs)   08:13, 16 April 2011

It has been deployed like this already, so changing it would break stuff. I'd say we'll keep it as it is and mark this ok.

#Comment by Hashar (talk | contribs)   18:16, 1 May 2011

I personally don't care. I was just raising the possible inconstancy enlighten by r81414 tests:

[x] Currentday is un padded
[x] Currentdaytwo is zero padded
[x] Localday is un padded
[x] Localdaytwo is zero padded
[x] Currentmonth is zero padded
[x] Currentmonthone is un padded
[x] Localmonth is zero padded
[x] Localmonthone is un padded
[x] Revisionday is un padded
[x] Revisiondaytwo is zero padded
[x] Revisionmonth is zero padded
[x] Revisionmonthone is un padded

It should be revisionmonttwo to be consistant with our other uses.

#Comment by Bryan (talk | contribs)   11:58, 6 May 2011

Has already been deployed and almost released. Let's not break stuff again, so marking this as ok.

Status & tagging log