Development

Changeset 8506

You must first sign up to be able to contribute.

Changeset 8506

Show
Ignore:
Timestamp:
04/17/08 17:56:05 (6 months ago)
Author:
fabien
Message:

fixed MySQL session storage

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/storage/sfDatabaseSessionStorage.class.php

    r8505 r8506  
    9898 
    9999    // get the database resource 
    100     $this->db = $database->getResource(); 
     100    $this->db = $database->getConnection(); 
    101101    if (is_null($this->db)) 
    102102    { 
  • branches/1.1/lib/storage/sfMySQLSessionStorage.class.php

    r8504 r8506  
    3939 
    4040    // cleanup the session id, just in case 
    41     $id = mysql_real_escape_string($id, $this->db); 
     41    $id = mysql_real_escape_string($id, $this->db->getResource()); 
    4242 
    4343    // delete the record associated with this id 
    4444    $sql = 'DELETE FROM '.$db_table.' WHERE '.$db_id_col.' = \''.$id.'\''; 
    4545 
    46     if (@mysql_query($sql, $this->db)) 
     46    if (@mysql_query($sql, $this->db->getResource())) 
    4747    { 
    4848      return true; 
     
    7171    $sql = 'DELETE FROM '.$db_table.' WHERE '.$db_time_col.' < '.(time() - $lifetime); 
    7272 
    73     if (!@mysql_query($sql, $this->db)) 
     73    if (!@mysql_query($sql, $this->db->getResource())) 
    7474    { 
    7575      throw new sfDatabaseException(sprintf('sfMySQLSessionStorage cannot delete old sessions (%s).', mysql_error())); 
     
    9797 
    9898    // cleanup the session id, just in case 
    99     $id = mysql_real_escape_string($id, $this->db); 
     99    $id = mysql_real_escape_string($id, $this->db->getResource()); 
    100100 
    101101    // delete the record associated with this id 
    102102    $sql = 'SELECT '.$db_data_col.' FROM '.$db_table.' WHERE '.$db_id_col.' = \''.$id.'\''; 
    103103 
    104     $result = @mysql_query($sql, $this->db); 
     104    $result = @mysql_query($sql, $this->db->getResource()); 
    105105 
    106106    if ($result != false && @mysql_num_rows($result) == 1) 
     
    116116      $sql = 'INSERT INTO '.$db_table.' ('.$db_id_col.', '.$db_data_col.', '.$db_time_col.') VALUES (\''.$id.'\', \'\', '.time().')'; 
    117117 
    118       if (@mysql_query($sql, $this->db)) 
     118      if (@mysql_query($sql, $this->db->getResource())) 
    119119      { 
    120120        return ''; 
     
    145145 
    146146    // cleanup the session id and data, just in case 
    147     $id   = mysql_real_escape_string($id, $this->db); 
    148     $data = mysql_real_escape_string($data, $this->db); 
     147    $id   = mysql_real_escape_string($id, $this->db->getResource()); 
     148    $data = mysql_real_escape_string($data, $this->db->getResource()); 
    149149 
    150150    // delete the record associated with this id 
    151151    $sql = 'UPDATE '.$db_table.' SET '.$db_data_col.' = \''.$data.'\', '.$db_time_col.' = '.time().' WHERE '.$db_id_col.' = \''.$id.'\''; 
    152152 
    153     if (@mysql_query($sql, $this->db)) 
     153    if (@mysql_query($sql, $this->db->getResource())) 
    154154    { 
    155155      return true;