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/lmbSessionStorage.interface.php ' );
1010lmb_require ('limb/dbal/src/criteria/lmbSQLFieldCriteria.class.php ' );
@@ -108,13 +108,15 @@ function storageWrite($session_id, $value)
108108 $ data = array ('last_activity_time ' => time (),
109109 'session_data ' => $ value );
110110
111+ $ this ->db ->begin ();
111112 if ($ rs ->count () > 0 )
112113 $ this ->db ->update ('lmb_session ' , $ data , $ crit );
113114 else
114115 {
115116 $ data ['session_id ' ] = "{$ session_id }" ;
116117 $ this ->db ->insert ('lmb_session ' , $ data , null );
117118 }
119+ $ this ->db ->commit ();
118120 }
119121
120122 /**
@@ -124,8 +126,10 @@ function storageWrite($session_id, $value)
124126 */
125127 function storageDestroy ($ session_id )
126128 {
129+ $ this ->db ->begin ();
127130 $ this ->db ->delete ('lmb_session ' ,
128131 new lmbSQLFieldCriteria ('session_id ' , $ session_id ));
132+ $ this ->db ->commit ();
129133 }
130134
131135 /**
@@ -139,8 +143,10 @@ function storageGc($max_life_time)
139143 if ($ this ->max_life_time )
140144 $ max_life_time = $ this ->max_life_time ;
141145
146+ $ this ->db ->begin ();
142147 $ this ->db ->delete ('lmb_session ' ,
143148 new lmbSQLFieldCriteria ('last_activity_time ' , time () - $ max_life_time , lmbSQLFieldCriteria::LESS ));
149+ $ this ->db ->commit ();
144150 }
145151}
146152
0 commit comments