find('first', array( 'conditions' => array($model->primaryKey => $id) )); if (empty($row[$model->alias]['data'])) { return false; } return $row[$model->alias]['data']; } /** * Helper function called on write for database sessions. * * @param integer $id ID that uniquely identifies session in database * @param mixed $data The value of the data to be saved. * @return boolean True for successful write, false otherwise. * @access private */ public static function write($id, $data) { $expires = time() + Configure::read('Session.timeout') * Security::inactiveMins(); $model =& ClassRegistry::getObject('Session'); $return = $model->save(compact('id', 'data', 'expires')); return $return; } /** * Method called on the destruction of a database session. * * @param integer $id ID that uniquely identifies session in database * @return boolean True for successful delete, false otherwise. * @access private */ public static function destroy($id) { $model =& ClassRegistry::getObject('Session'); $return = $model->delete($id); return $return; } /** * Helper function called on gc for database sessions. * * @param integer $expires Timestamp (defaults to current time) * @return boolean Success * @access private */ public static function gc($expires = null) { $model =& ClassRegistry::getObject('Session'); if (!$expires) { $expires = time(); } $return = $model->deleteAll(array($model->alias . ".expires <" => $expires), false, false); return $return; } }