From 54f7154db8146e42dfa557d3d0651fd3255ac380 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 31 Jan 2011 11:45:19 -0800 Subject: [PATCH] Fix for ticket #3020: set MySQL session time_zone variable to UTC ('+0:00') so TIMESTAMP column values are comparable against our other UTC timestamp values. MySQL stores TIMESTAMP columns as UTC, but with a local time interface. (SRSLY?!) DATETIME columns are always bare and assumed to be local time, but we keep only UTC in them. Forcing the session time_zone to UTC means we won't have to worry as much about what we're sending/receiving in there. Also will let us remove the hack in master commit a7abb2323e7d57125b9fbc903a1cecc06c27944e for session tweaks --- classes/Memcached_DataObject.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index d50b4071d1..a3c2de8e64 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -480,6 +480,10 @@ class Memcached_DataObject extends Safe_DataObject } } } + // Needed to make timestamp values usefully comparable. + if (common_config('db', 'type') == 'mysql') { + parent::_query("set time_zone='+0:00'"); + } } return $result;