Changeset 17529 for branches/version-2/data/class
- Timestamp:
- 2008/08/13 14:55:27 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2/data/class/helper/SC_Helper_Session.php
r16850 r17529 13 13 * @version $Id$ 14 14 */ 15 class SC_Helper_Session { 15 class SC_Helper_Session { 16 17 var $objDb; 16 18 17 19 // }}} … … 24 26 */ 25 27 function SC_Helper_Session() { 26 $objDb = new SC_Helper_DB_Ex(); 27 if($objDb->sfTabaleExists("dtb_session")) { 28 session_set_save_handler(array(&$this, "sfSessOpen"), 29 array(&$this, "sfSessClose"), 30 array(&$this, "sfSessRead"), 31 array(&$this, "sfSessWrite"), 32 array(&$this, "sfSessDestroy"), 33 array(&$this, "sfSessGc")); 34 } 28 $this->objDb = new SC_Helper_DB_Ex(); 29 session_set_save_handler(array(&$this, "sfSessOpen"), 30 array(&$this, "sfSessClose"), 31 array(&$this, "sfSessRead"), 32 array(&$this, "sfSessWrite"), 33 array(&$this, "sfSessDestroy"), 34 array(&$this, "sfSessGc")); 35 35 } 36 36 … … 65 65 */ 66 66 function sfSessRead($id) { 67 if (!$this->objDb->sfTabaleExists("dtb_session")) return ''; 67 68 $objQuery = new SC_Query(); 68 69 $arrRet = $objQuery->select("sess_data", "dtb_session", "sess_id = ?", array($id)); 69 70 if (empty($arrRet)) { 70 return null;71 return ''; 71 72 } else { 72 return ($arrRet[0]['sess_data']);73 return $arrRet[0]['sess_data']; 73 74 } 74 75 } … … 83 84 function sfSessWrite($id, $sess_data) 84 85 { 86 if (!$this->objDb->sfTabaleExists("dtb_session")) return false; 85 87 $objQuery = new SC_Query(); 86 88 $count = $objQuery->count("dtb_session", "sess_id = ?", array($id)); … … 113 115 */ 114 116 function sfSessDestroy($id) { 117 if (!$this->objDb->sfTabaleExists("dtb_session")) return false; 115 118 $objQuery = new SC_Query(); 116 119 $objQuery->delete("dtb_session", "sess_id = ?", array($id)); … … 127 130 function sfSessGc($maxlifetime) { 128 131 // MAX_LIFETIME以上更新されていないセッションを削除する。 132 if (!$this->objDb->sfTabaleExists("dtb_session")) return false; 129 133 $objQuery = new SC_Query(); 130 134 $where = "update_date < current_timestamp + '-". MAX_LIFETIME . " secs'";
Note: See TracChangeset
for help on using the changeset viewer.