From 202035fc68d8b2364436cef75d68ac2a610e42c0 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 11 Apr 2016 19:19:58 -0700 Subject: move all DB session storage logic to SessionHandler where it belongs --- Zotlabs/Web/Session.php | 5 +---- Zotlabs/Web/SessionHandler.php | 9 +++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Web') diff --git a/Zotlabs/Web/Session.php b/Zotlabs/Web/Session.php index 68af74521..0cd83c15e 100644 --- a/Zotlabs/Web/Session.php +++ b/Zotlabs/Web/Session.php @@ -77,10 +77,7 @@ class Session { session_regenerate_id(false); if(self::$handler) { - $v = q("UPDATE session SET sid = '%s' WHERE sid = '%s'", - dbesc(session_id()), - dbesc($old_sid) - ); + self::$handler->rename($old_sid,session_id()); } else logger('no session handler'); diff --git a/Zotlabs/Web/SessionHandler.php b/Zotlabs/Web/SessionHandler.php index 670e8f216..359279384 100644 --- a/Zotlabs/Web/SessionHandler.php +++ b/Zotlabs/Web/SessionHandler.php @@ -80,4 +80,13 @@ class SessionHandler implements \SessionHandlerInterface { } + // not part of the official interface, used when regenerating the session id + + function rename($old,$new) { + $v = q("UPDATE session SET sid = '%s' WHERE sid = '%s'", + dbesc($new), + dbesc($old) + ); + } + } \ No newline at end of file -- cgit v1.2.3