From 67cdbe45389ed7fc5124c48b6508b00298fe5516 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 6 Nov 2016 01:00:17 -0400 Subject: [PATCH] misc performance: restore session write condition, keep 1 query --- include/session.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/session.php b/include/session.php index 8cce1488b1..8a1a3c55de 100644 --- a/include/session.php +++ b/include/session.php @@ -72,8 +72,9 @@ function ref_session_write($id, $data) { if ($session_exists) { $r = q("UPDATE `session` SET `data` = '%s', `expire` = '%s' - WHERE `sid` = '%s'", - dbesc($data), dbesc($expire), dbesc($id)); + WHERE `sid` = '%s' + AND (`data` != '%s' OR `expire` != '%s'", + dbesc($data), dbesc($expire), dbesc($id), dbesc($data), dbesc($expire)); } else { $r = q("INSERT INTO `session` SET `sid` = '%s', `expire` = '%s', `data` = '%s'", -- 2.39.5