Skip to content

Commit

Permalink
Extended the SessionHandler to add a method clear all sessions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhallbachner committed Jun 16, 2013
1 parent b7e4e56 commit 6b93b2a
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Adapters/SessionHandlerAdapter.php
Expand Up @@ -5,7 +5,26 @@
use Stash\Session;

if(version_compare(phpversion(), '5.4.0', '>=')){
class SessionHandlerAdapter extends Session {}
class SessionHandlerAdapterShim extends Session {}
} else {
class SessionHandlerAdapter extends Session implements \SessionHandlerInterface {}
class SessionHandlerAdapterShim extends Session implements \SessionHandlerInterface {}
}

class SessionHandlerAdapter extends SessionHandlerAdapterShim
{
protected function getCache($session_id)
{
$path = 'ss_ss/' .
base64_encode($this->path) . '/' .
base64_encode($this->name) . '/' .
base64_encode($session_id);

return $this->pool->getItem($path);
}

public function clearAll()
{
$item = $this->pool->getItem('ss_ss');
$item->clear();
}
}

0 comments on commit 6b93b2a

Please sign in to comment.