summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-10-09 10:39:56 -0400
committerEvan Prodromou <evan@status.net>2009-10-09 10:40:22 -0400
commit3727b17c39a9dba97b08f15211e3631c82162fdf (patch)
tree4f2556740a0cf3040d1cba5f126ecd57b77b5ea7
parentf46084309b72e647ee6552669a009cf5b3fbff5a (diff)
don't write session if it's unchanged
-rw-r--r--classes/Session.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/classes/Session.php b/classes/Session.php
index d641edbbe..79a69a96e 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);
+ }
}
}