Created
May 30, 2012 23:18
-
-
Save rmarscher/2839513 to your computer and use it in GitHub Desktop.
Lithium session config for operating on only one configuration by default
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use lithium\storage\Session; | |
$methods = array('read', 'write', 'delete', 'clear', 'check'); | |
foreach ($methods as $method) { | |
$filter = function($self, $params, $chain) use ($method) { | |
if ($params['options']['name'] === null) { | |
if ($params['configuration'] !== 'default') { | |
// dump("returning false for {$params['configuration']} for {$method}"); | |
return false; | |
} | |
} | |
// dump("continuing with {$params['configuration']} for {$method}"); | |
return $chain->next($self, $params, $chain); | |
}; | |
Session::applyFilter($method, $filter); | |
} | |
$default = array( | |
'adapter' => 'Model', | |
'model' => 'app\models\Sessions', | |
'name' => 'session', | |
'cookie_lifetime' => 0, | |
'gc_maxlifetime' => 21600 | |
); | |
$cookie = array( | |
'adapter' => 'Cookie', | |
'name' => 'anon', | |
'expire' => '+1 year', | |
'strategies' => array('Encrypt' => array('secret' => '!!removed!!')) | |
); | |
Session::config(compact('default', 'cookie')); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment