r23914 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23913‎ | r23914 | r23915 >
Date:18:45, 9 July 2007
Author:brion
Status:old
Tags:
Comment:
Assume last year, not this year, when jumping to a month that hasn't happened yet this year
Modified paths:
  • /trunk/phase3/includes/SpecialContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialContributions.php
@@ -22,7 +22,7 @@
2323
2424 $this->year = ($year > 0 && $year < 10000) ? $year : false;
2525 $this->month = ($month > 0 && $month < 13) ? $month : false;
26 - $this->GetDateCond();
 26+ $this->getDateCond();
2727
2828 $this->mDb = wfGetDB( DB_SLAVE, 'contributions' );
2929 }
@@ -78,6 +78,11 @@
7979 $year_start = $this->year;
8080 } else {
8181 $year_start = substr( wfTimestampNow(), 0, 4 );
 82+ $thisMonth = gmdate( 'n' );
 83+ if( $this->month > $thisMonth ) {
 84+ // Future contributions aren't supposed to happen. :)
 85+ $year_start--;
 86+ }
8287 }
8388
8489 if ( $this->month ) {
@@ -274,7 +279,12 @@
275280 if ( ( $year = $wgRequest->getIntOrNull( 'year' ) ) !== null ) {
276281 $options['year'] = intval( $year );
277282 } else if( $options['month'] ) {
278 - $options['year'] = intval( substr( wfTimestampNow(), 0, 4 ) );
 283+ $thisMonth = intval( gmdate( 'n' ) );
 284+ $thisYear = intval( gmdate( 'Y' ) );
 285+ if( intval( $options['month'] ) > $thisMonth ) {
 286+ $thisYear--;
 287+ }
 288+ $options['year'] = $thisYear;
279289 } else {
280290 $options['year'] = '';
281291 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r24096Merged revisions 23910-24094 via svnmerge from...david22:38, 14 July 2007

Status & tagging log