File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,10 +34,11 @@ class lmbSessionDbStorage implements lmbSessionStorage
3434 /**
3535 * Constructor.
3636 * @param lmbDbConnection database connection object
37- * @param integer maximum session life time
3837 */
39- function __construct ($ db_connection, $ max_life_time = null )
38+ function __construct ($ db_connection )
4039 {
40+ $ max_life_time = lmb_env_get ('LIMB_SESSION_DB_MAX_LIFE_TIME ' );
41+
4142 $ this ->max_life_time = $ max_life_time ;
4243
4344 $ this ->db = new lmbSimpleDb ($ db_connection );
Original file line number Diff line number Diff line change 22/*
33 * Limb PHP Framework
44 *
5- * @link http://limb-project.com
5+ * @link http://limb-project.com
66 * @copyright Copyright © 2004-2009 BIT(http://bit-creative.com)
7- * @license LGPL http://www.gnu.org/copyleft/lesser.html
7+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
88 */
99lmb_require ('limb/session/src/lmbSessionDbStorage.class.php ' );
1010lmb_require ('limb/dbal/src/lmbSimpleDb.class.php ' );
@@ -183,7 +183,8 @@ function testStorageGcTrue()
183183
184184 function testStorageGcUseSettedMaxLifeTime ()
185185 {
186- $ driver = new lmbSessionDbStorage ($ this ->conn , $ max_life_time = 500 );
186+ lmb_env_setor ('LIMB_SESSION_DB_MAX_LIFE_TIME ' , 500 );
187+ $ driver = new lmbSessionDbStorage ($ this ->conn );
187188
188189 $ this ->db ->insert ('lmb_session ' ,
189190 array ('session_id ' => "whatever " ,
Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ class lmbSessionStartupFilter implements lmbInterceptingFilter
2929 */
3030 function run ($ filter_chain )
3131 {
32- $ session_in_db = defined ('LIMB_SESSION_USE_DB_DRIVER ' ) ? LIMB_SESSION_USE_DB_DRIVER : false ;
32+ $ session_in_db = lmb_env_get ('LIMB_SESSION_USE_DB_DRIVER ' , false );
33+
3334 if ($ session_in_db )
3435 $ storage = $ this ->_createDBSessionStorage ();
3536 else
@@ -53,11 +54,9 @@ protected function _createNativeSessionStorage()
5354 */
5455 protected function _createDBSessionStorage ()
5556 {
56- $ lifetime = defined ('LIMB_SESSION_DB_MAX_LIFE_TIME ' ) ? LIMB_SESSION_DB_MAX_LIFE_TIME : null ;
57-
5857 lmb_require ('limb/session/src/lmbSessionDbStorage.class.php ' );
5958 $ db_connection = lmbToolkit :: instance ()->getDefaultDbConnection ();
60- return new lmbSessionDbStorage ($ db_connection, $ lifetime );
59+ return new lmbSessionDbStorage ($ db_connection );
6160 }
6261}
6362
You can’t perform that action at this time.
0 commit comments