Changeset 8664
- Timestamp:
- 04/28/08 22:42:14 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/lib/storage/sfMySQLSessionStorage.class.php
r7791 r8664 124 124 * Cleans up old sessions. 125 125 * 126 * @param int The lifetime of a session 126 * @param int The lifetime of a session in seconds 127 127 * 128 128 * @return boolean true, if old sessions have been cleaned, otherwise an exception is thrown … … 132 132 public function sessionGC($lifetime) 133 133 { 134 // determine deletable session time135 $time = time() - $lifetime;136 137 134 // get table/column 138 135 $db_table = $this->getParameterHolder()->get('db_table'); … … 141 138 // delete the record associated with this id 142 139 $sql = 'DELETE FROM '.$db_table.' '. 143 'WHERE '.$db_time_col.' < '.$time;140 'WHERE '.$db_time_col.' + INTERVAL '.$lifetime.' SECOND < NOW()'; 144 141 145 142 if (@mysql_query($sql, $this->resource)) … … 217 214 $sql = 'INSERT INTO '.$db_table.' ('.$db_id_col.', ' . 218 215 $db_data_col.', '.$db_time_col.') VALUES (' . 219 '\''.$id.'\', \'\', '.time().')';216 '\''.$id.'\', \'\', NOW())'; 220 217 221 218 if (@mysql_query($sql, $this->resource)) … … 257 254 $sql = 'UPDATE '.$db_table.' ' . 258 255 'SET '.$db_data_col.' = \''.$data.'\', ' . 259 $db_time_col.' = '.time().'' .256 $db_time_col.' = NOW() ' . 260 257 'WHERE '.$db_id_col.' = \''.$id.'\''; 261 258