_db->select(); $select->from($this->_getPair(), ['id']); $select->where("closed = 'n'"); return $select->query(); } public function markSessionClosed($sessionId) { return $this->_getTable()->updateDataByKey(['closed' => 'y', 'closedAt' => date('Y-m-d H:i:s')], $sessionId); } public function sessionExists($sessionId) { $file = $this->getSessionSavePath() . '/sess_' . $sessionId; return file_exists($file); } public function setSessionSavePath($sessionSavePath) { $this->_sessionSavePath = $sessionSavePath; return $this; } public function getSessionSavePath() { if (null === $this->_sessionSavePath) { $this->_sessionSavePath = session_save_path(); if (empty($this->_sessionSavePath)) { $this->_sessionSavePath = sys_get_temp_dir(); } } return $this->_sessionSavePath; } public function removeHistory($months) { if (empty($months)) { return 0; } $affectedRows = $this->_getTable('ViewControllerLogSession')->delete( '`added` < DATE_SUB(NOW(), INTERVAL ' . $this->_db->quote($months, Qs_Db::INT_TYPE) . ' MONTH)' ); return $affectedRows; } }