Changeset 5247 in subversion
- Timestamp:
- Sep 20, 2011 3:34:48 AM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube_session.php
r5226 r5247 53 53 public function __construct($db, $config) 54 54 { 55 $this->db = $db;56 $this->start = microtime(true);57 $this->ip = $_SERVER['REMOTE_ADDR'];55 $this->db = $db; 56 $this->start = microtime(true); 57 $this->ip = $_SERVER['REMOTE_ADDR']; 58 58 $this->logging = $config->get('log_session', false); 59 59 … … 127 127 { 128 128 $sql_result = $this->db->query( 129 "SELECT vars, ip, changed FROM ".get_table_name('session') ." WHERE sess_id = ?",130 $key);131 132 if ($sql_ arr = $this->db->fetch_assoc($sql_result)) {129 "SELECT vars, ip, changed FROM ".get_table_name('session') 130 ." WHERE sess_id = ?", $key); 131 132 if ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) { 133 133 $this->changed = strtotime($sql_arr['changed']); 134 134 $this->ip = $sql_arr['ip']; … … 157 157 $now = $this->db->fromunixtime((int)$ts); 158 158 159 // no session row in DB (db_read() returns false) 160 if (!$this->key) { 161 $oldvars = false; 162 } 159 163 // use internal data from read() for fast requests (up to 0.5 sec.) 160 if ($key == $this->key && (!$this->vars || $ts - $this->start < 0.5)) {164 else if ($key == $this->key && (!$this->vars || $ts - $this->start < 0.5)) { 161 165 $oldvars = $this->vars; 162 } else { // else read data again from DB 166 } 167 else { // else read data again from DB 163 168 $oldvars = $this->db_read($key); 164 169 } … … 281 286 $ts = microtime(true); 282 287 288 // no session data in cache (mc_read() returns false) 289 if (!$this->key) 290 $oldvars = false; 283 291 // use internal data for fast requests (up to 0.5 sec.) 284 if ($key == $this->key && (!$this->vars || $ts - $this->start < 0.5))292 else if ($key == $this->key && (!$this->vars || $ts - $this->start < 0.5)) 285 293 $oldvars = $this->vars; 286 294 else // else read data again
Note: See TracChangeset
for help on using the changeset viewer.
