misc performance: restore session write condition, keep 1 query

This commit is contained in:
Hypolite Petovan 2016-11-06 01:00:17 -04:00
parent 7b9470b804
commit 67cdbe4538

View File

@ -72,8 +72,9 @@ function ref_session_write($id, $data) {
if ($session_exists) { if ($session_exists) {
$r = q("UPDATE `session` $r = q("UPDATE `session`
SET `data` = '%s', `expire` = '%s' SET `data` = '%s', `expire` = '%s'
WHERE `sid` = '%s'", WHERE `sid` = '%s'
dbesc($data), dbesc($expire), dbesc($id)); AND (`data` != '%s' OR `expire` != '%s'",
dbesc($data), dbesc($expire), dbesc($id), dbesc($data), dbesc($expire));
} else { } else {
$r = q("INSERT INTO `session` $r = q("INSERT INTO `session`
SET `sid` = '%s', `expire` = '%s', `data` = '%s'", SET `sid` = '%s', `expire` = '%s', `data` = '%s'",