r71751 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71750‎ | r71751 | r71752 >
Date:21:02, 26 August 2010
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
Merge r71750 to trunk: let wfTimestamp() accept TS_RFC2822 as an input format in addition to output
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -1951,7 +1951,7 @@
19521952 function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) {
19531953 $uts = 0;
19541954 $da = array();
1955 - if ( $ts == 0 ) {
 1955+ if ( $ts === 0 ) {
19561956 $uts = time();
19571957 } elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D', $ts, $da ) ) {
19581958 # TS_DB
@@ -1972,6 +1972,9 @@
19731973 # TS_POSTGRES
19741974 } elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d* GMT$/', $ts, $da ) ) {
19751975 # TS_POSTGRES
 1976+ } elseif ( preg_match( '/^[A-Z][a-z]{2}, \d\d [A-Z][a-z]{2} \d{4} \d\d:\d\d:\d\d/', $ts ) ) {
 1977+ # TS_RFC2822
 1978+ $uts = strtotime( $ts );
19761979 } else {
19771980 # Bogus value; fall back to the epoch...
19781981 wfDebug("wfTimestamp() fed bogus time value: $outputtype; $ts\n");
Property changes on: trunk/phase3/includes/GlobalFunctions.php
___________________________________________________________________
Added: svn:mergeinfo
19791982 Merged /branches/new-installer/phase3/includes/GlobalFunctions.php:r43664-66004
19801983 Merged /branches/wmf-deployment/includes/GlobalFunctions.php:r53381
19811984 Merged /branches/REL1_15/phase3/includes/GlobalFunctions.php:r51646
19821985 Merged /branches/resourceloader/phase3/includes/GlobalFunctions.php:r71750
19831986 Merged /branches/sqlite/includes/GlobalFunctions.php:r58211-58321

Follow-up revisions

RevisionCommit summaryAuthorDate
r77401Fix bug discovered in r77171 from the user data in If-Modified-Since passed b...platonides21:59, 28 November 2010
r79013(Bug 26425) Due to r71751, wfTimestamp stopped accepting '' to mean get ...bawolff04:38, 26 December 2010
r79072(Bug 26434) - Generated password from "Create account by email" does not work....platonides17:17, 27 December 2010
r79213Followup r71751: change strict comparison to loose per CR, and add a comment ...catrope22:28, 29 December 2010
r79253Fix r71751 problems with textual parameters....platonides16:10, 30 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r71750resourceloader: Implement support for inputting TS_RFC2822 into wfTimestamp()...catrope20:55, 26 August 2010

Comments

#Comment by Bryan (talk | contribs)   19:23, 26 December 2010

This changes behaviour when the input is "" accorinding to r79013. Is this deliberate?

#Comment by Platonides (talk | contribs)   17:18, 27 December 2010

Also produced bug 26434. I recommend reverting to ==

#Comment by Catrope (talk | contribs)   22:29, 29 December 2010

Done in r79213

#Comment by Reedy (talk | contribs)   01:49, 6 January 2011

Marking as resolved, as it's essentially been rewritten in r79013

Status & tagging log