diff options
-rw-r--r-- | core/Session.php | 3 | ||||
-rw-r--r-- | core/Session/SaveHandler/DbTable.php | 11 |
2 files changed, 6 insertions, 8 deletions
diff --git a/core/Session.php b/core/Session.php index 7109dd0db2..787affe29d 100644 --- a/core/Session.php +++ b/core/Session.php @@ -89,15 +89,12 @@ class Session extends Zend_Session // - user - we can't verify that user-defined session handler functions have already been set via session_set_save_handler() // - mm - this handler is not recommended, unsupported, not available for Windows, and has a potential concurrency issue - $db = Db::get(); - $config = array( 'name' => Common::prefixTable('session'), 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime', - 'db' => $db, ); $saveHandler = new DbTable($config); diff --git a/core/Session/SaveHandler/DbTable.php b/core/Session/SaveHandler/DbTable.php index 8521215c9b..20494fe98e 100644 --- a/core/Session/SaveHandler/DbTable.php +++ b/core/Session/SaveHandler/DbTable.php @@ -9,6 +9,7 @@ namespace Piwik\Session\SaveHandler; +use Piwik\Db; use Zend_Session; use Zend_Session_SaveHandler_Interface; @@ -49,7 +50,7 @@ class DbTable implements Zend_Session_SaveHandler_Interface */ public function open($save_path, $name) { - $this->config['db']->getConnection(); + Db::get()->getConnection(); return true; } @@ -76,7 +77,7 @@ class DbTable implements Zend_Session_SaveHandler_Interface . ' WHERE ' . $this->config['primary'] . ' = ?' . ' AND ' . $this->config['modifiedColumn'] . ' + ' . $this->config['lifetimeColumn'] . ' >= ?'; - $result = $this->config['db']->fetchOne($sql, array($id, time())); + $result = Db::get()->fetchOne($sql, array($id, time())); if (!$result) $result = ''; @@ -103,7 +104,7 @@ class DbTable implements Zend_Session_SaveHandler_Interface . $this->config['lifetimeColumn'] . ' = ?,' . $this->config['dataColumn'] . ' = ?'; - $this->config['db']->query($sql, array($id, time(), $this->maxLifetime, $data, time(), $this->maxLifetime, $data)); + Db::get()->query($sql, array($id, time(), $this->maxLifetime, $data, time(), $this->maxLifetime, $data)); return true; } @@ -120,7 +121,7 @@ class DbTable implements Zend_Session_SaveHandler_Interface $sql = 'DELETE FROM ' . $this->config['name'] . ' WHERE ' . $this->config['primary'] . ' = ?'; - $this->config['db']->query($sql, array($id)); + Db::get()->query($sql, array($id)); return true; } @@ -137,7 +138,7 @@ class DbTable implements Zend_Session_SaveHandler_Interface $sql = 'DELETE FROM ' . $this->config['name'] . ' WHERE ' . $this->config['modifiedColumn'] . ' + ' . $this->config['lifetimeColumn'] . ' < ?'; - $this->config['db']->query($sql, array(time())); + Db::get()->query($sql, array(time())); return true; } |