Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fix session handling for creation and destruction

on creation the session gets immediatly written
into the database before any parallel running thread
might insert it as well
(without this the session will only be written into
the database when actual data is put in)

on destruction the session will now not really be
wiped from the database, but all data will be cleared
from it

(refs #3530)
  • Loading branch information...
lazyfrosch committed Feb 6, 2013
1 parent 29e53ee commit 2b164cd62b2bb98d8507c0a3c1043a9578ae9abc
Showing with 15 additions and 8 deletions.
  1. +15 −8 app/modules/AppKit/lib/storage/AppKitDoctrineSessionStorage.class.php
@@ -63,16 +63,19 @@ public function sessionClose() {
*/
public function sessionDestroy($id) {
$result = AppKitDoctrineUtil::createQuery()
->delete('NsmSession')
->andWhere('session_name=? and session_id=?', array($this->getParameter('session_name'), $id))
->execute();
AppKitLogger::verbose("Destroying session (%s)", $id);
if ($result > 0) {
return true;
}
// loading the session and clearing its data
// please be aware, we are not really deleting the session
// from the database, but emptying its data
// this helps with proper session handling on logon
return false;
$this->sessionRead($id);
$data = '';
$this->sessionWrite($id, $data);
return true;
}
@@ -135,6 +138,10 @@ public function sessionRead($id) {
$this->NsmSession->session_id = $id;
$this->NsmSession->session_name = $session_name;
// Immediately saving it empty
$data = '';
$this->sessionWrite($id, $data);
return '';
} else {
AppKitLogger::verbose("Session found in database, reading data");

0 comments on commit 2b164cd

Please sign in to comment.
You can’t perform that action at this time.