]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
don't write session if it's unchanged
authorEvan Prodromou <evan@status.net>
Fri, 9 Oct 2009 14:39:56 +0000 (10:39 -0400)
committerEvan Prodromou <evan@status.net>
Fri, 9 Oct 2009 14:39:56 +0000 (10:39 -0400)
classes/Session.php

index d641edbbe408af12c87bdcd32a416672429d2eeb..79a69a96ea3dc11b1f93672890f1687f2e263fa0 100644 (file)
@@ -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);
+            }
         }
     }