Page MenuHomePhabricator

mwpgtimestamps.patch

Authored By
bzimport
Nov 21 2014, 9:17 PM
Size
1 KB
Referenced Files
None
Subscribers
None

mwpgtimestamps.patch

Index: includes/DatabasePostgres.php
===================================================================
--- includes/DatabasePostgres.php (revision 15709)
+++ includes/DatabasePostgres.php (working copy)
@@ -532,7 +532,7 @@
# Return DB-style timestamp used for MySQL schema
function timestamp( $ts=0 ) {
- return wfTimestamp(TS_DB,$ts);
+ return wfTimestamp(TS_POSTGRES,$ts);
}
/**
Index: includes/GlobalFunctions.php
===================================================================
--- includes/GlobalFunctions.php (revision 15709)
+++ includes/GlobalFunctions.php (working copy)
@@ -1294,6 +1294,11 @@
define('TS_ORACLE', 6);
/**
+ * PostgreSQL format time.
+ */
+define('TS_POSTGRES', 7);
+
+/**
* @param mixed $outputtype A timestamp in one of the supported formats, the
* function will autodetect which format is supplied
* and act accordingly.
@@ -1327,6 +1332,10 @@
# TS_ISO_8601
$uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
(int)$da[2],(int)$da[3],(int)$da[1]);
+ } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)[\+\- ](\d\d)$/",$ts,$da)) {
+ # TS_POSTGRES
+ $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
+ (int)$da[2],(int)$da[3],(int)$da[1]);
} else {
# Bogus value; fall back to the epoch...
wfDebug("wfTimestamp() fed bogus time value: $outputtype; $ts\n");
@@ -1350,6 +1359,8 @@
return gmdate( 'D, d M Y H:i:s', $uts ) . ' GMT';
case TS_ORACLE:
return gmdate( 'd-M-y h.i.s A', $uts) . ' +00:00';
+ case TS_POSTGRES:
+ return gmdate( 'Y-m-d H:i:s', $uts ) . ' GMT';
default:
throw new MWException( 'wfTimestamp() called with illegal output type.');
}

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2503
Default Alt Text
mwpgtimestamps.patch (1 KB)

Event Timeline