Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
Fix session handling for creation and destruction
Browse files Browse the repository at this point in the history
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 2b164cd
Showing 1 changed file with 15 additions and 8 deletions.
Expand Up @@ -63,16 +63,19 @@ public function sessionClose() {
*/ */
public function sessionDestroy($id) { public function sessionDestroy($id) {


$result = AppKitDoctrineUtil::createQuery() AppKitLogger::verbose("Destroying session (%s)", $id);
->delete('NsmSession')
->andWhere('session_name=? and session_id=?', array($this->getParameter('session_name'), $id))
->execute();


if ($result > 0) { // loading the session and clearing its data
return true; // 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;


} }


Expand Down Expand Up @@ -135,6 +138,10 @@ public function sessionRead($id) {
$this->NsmSession->session_id = $id; $this->NsmSession->session_id = $id;
$this->NsmSession->session_name = $session_name; $this->NsmSession->session_name = $session_name;


// Immediately saving it empty
$data = '';
$this->sessionWrite($id, $data);

return ''; return '';
} else { } else {
AppKitLogger::verbose("Session found in database, reading data"); AppKitLogger::verbose("Session found in database, reading data");
Expand Down

0 comments on commit 2b164cd

Please sign in to comment.