Permalink
Browse files

perf(db): improved session write db query for InnoDB

fixes #7656
  • Loading branch information...
jdalsem committed Mar 16, 2016
1 parent c2b2f7f commit 3b55226d43d0feaea75488d19c8b8e8a6fd1d941
Showing with 4 additions and 3 deletions.
  1. +4 −3 engine/classes/Elgg/Http/DatabaseSessionHandler.php
@@ -5,7 +5,7 @@
* Database session handler
*
* @access private
*
*
* @package Elgg.Core
* @subpackage Http
*/
@@ -53,9 +53,10 @@ public function write($session_id, $session_data) {
$time = time();
$sess_data_sanitised = sanitize_string($session_data);
$query = "REPLACE INTO {$this->db->getTablePrefix()}users_sessions
$query = "INSERT INTO {$this->db->getTablePrefix()}users_sessions
(session, ts, data) VALUES
('$id', '$time', '$sess_data_sanitised')";
('$id', '$time', '$sess_data_sanitised')
ON DUPLICATE KEY UPDATE ts = '$time', data = '$sess_data_sanitised'";
if ($this->db->insertData($query) !== false) {
return true;

0 comments on commit 3b55226

Please sign in to comment.