Last modified: 2010-05-15 15:41:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T8632, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 6632 - Timestamp with zone and PostgreSQL
Timestamp with zone and PostgreSQL
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.7.x
PC Linux
: High normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2006-07-11 18:11 UTC by GBurri
Modified: 2010-05-15 15:41 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
adds postgresql time format definition (1.68 KB, patch)
2006-07-17 21:15 UTC, Robert Treat
Details

Description GBurri 2006-07-11 18:11:55 UTC
The date fields are created with the 'timestamptz' type under PostgreSQL so the
time zone should be supported.
in this case, 'wfTimestamp' (GlobalFunctions.php) can receive a date like this
one : '2006-07-11 10:36:00+02'.

I propose to add these lines : 
function wfTimestamp($outputtype=TS_UNIX,$ts=0) {
	$uts = 0;
	$da = array();
	if ($ts==0) {
		$uts=time();
	} elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d)
(\d\d):(\d\d):(\d\d)$/D",$ts,$da)) {
		# TS_DB
		$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)$/D",$ts,$da)) {
+		# TS_DBTZ
+		$uts=gmmktime((int)$da[4] + (int)$da[7],(int)$da[5],(int)$da[6],
+			    (int)$da[2],(int)$da[3],(int)$da[1]);
Comment 1 Robert Treat 2006-07-17 21:15:40 UTC
Created attachment 2117 [details]
adds postgresql time format definition
Comment 2 Robert Treat 2006-07-17 21:15:56 UTC
I'm not sure I fully understand the above. AFAICT the issue I have had with
postgresql is that the mediawiki software attempts to operate as if the db is
working in GMT, which throws off timestamps which may be at a different
timezone.  The attached patch implements a POSTGRES timestamp definition within
mediawiki, and adjusts it accordingly. This method worked well for wikipgedia. 
Comment 3 Domas Mituzas 2006-07-18 07:45:23 UTC
I think bigger error is to create date fields with timezone information. 
Initial PG support did use 'timestamp without timezone' everywhere. 
Comment 4 Greg Sabino Mullane 2007-03-26 01:07:13 UTC
Going to close this for now as resolved: if specific timestamp related errors
come up, please reopen of open a new bug.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links