From: Evan Prodromou Date: Fri, 9 Oct 2009 14:39:56 +0000 (-0400) Subject: don't write session if it's unchanged X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=88e7092d2326403ab5cb0c7261b665154491e75c;p=quix0rs-gnu-social.git don't write session if it's unchanged --- diff --git a/classes/Session.php b/classes/Session.php index d641edbbe4..79a69a96ea 100644 --- a/classes/Session.php +++ b/classes/Session.php @@ -85,9 +85,18 @@ class Session extends Memcached_DataObject return $session->insert(); } else { - $session->session_data = $session_data; + if (strcmp($session->session_data, $session_data) == 0) { + self::logdeb("Not writing session '$id'; unchanged"); + return true; + } else { + self::logdeb("Session '$id' data changed; updating"); + + $orig = clone($session); + + $session->session_data = $session_data; - return $session->update(); + return $session->update($orig); + } } }