From 1a982d8a5416e15d36b16145d9ec599d49eb755a Mon Sep 17 00:00:00 2001 From: diosmosis Date: Fri, 21 Mar 2014 10:11:25 +0000 Subject: Get Db connection singleton in DbTable session handler upon use instead of storing the connection upon creation. --- core/Session/SaveHandler/DbTable.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'core/Session') 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; } -- cgit v1.2.3