r71750 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71749‎ | r71750 | r71751 >
Date:20:55, 26 August 2010
Author:catrope
Status:deferred
Tags:
Comment:
resourceloader: Implement support for inputting TS_RFC2822 into wfTimestamp(). Will merge to trunk
Modified paths:
  • /branches/resourceloader/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: branches/resourceloader/phase3/includes/GlobalFunctions.php
@@ -1898,7 +1898,7 @@
18991899 function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) {
19001900 $uts = 0;
19011901 $da = array();
1902 - if ($ts==0) {
 1902+ if ($ts === 0) {
19031903 $uts=time();
19041904 } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D',$ts,$da)) {
19051905 # TS_DB
@@ -1919,6 +1919,9 @@
19201920 # TS_POSTGRES
19211921 } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d* GMT$/',$ts,$da)) {
19221922 # TS_POSTGRES
 1923+ } elseif (preg_match('/^[A-Z][a-z]{2}, \d\d [A-Z][a-z]{2} \d{4} \d\d:\d\d:\d\d/', $ts)) {
 1924+ # TS_RFC2822
 1925+ $uts = strtotime( $ts );
19231926 } else {
19241927 # Bogus value; fall back to the epoch...
19251928 wfDebug("wfTimestamp() fed bogus time value: $outputtype; $ts\n");

Follow-up revisions

RevisionCommit summaryAuthorDate
r71751Merge r71750 to trunk: let wfTimestamp() accept TS_RFC2822 as an input format...catrope21:02, 26 August 2010
r77401Fix bug discovered in r77171 from the user data in If-Modified-Since passed b...platonides21:59, 28 November 2010

Status & tagging log