diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2014-03-21 14:11:25 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2014-03-21 14:14:02 +0400 |
commit | 1a982d8a5416e15d36b16145d9ec599d49eb755a (patch) | |
tree | 71b320d3d02268506b8351522e838ccd3bd97f7c /core/Session | |
parent | e09d673cc2fe77f45c47507bc6f988ab21458cb7 (diff) |
Get Db connection singleton in DbTable session handler upon use instead of storing the connection upon creation.
Diffstat (limited to 'core/Session')
-rw-r--r-- | core/Session/SaveHandler/DbTable.php | 11 |
1 files changed, 6 insertions, 5 deletions
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; } |