_closeSessions(); if (empty($this->_removeHistoryDays) || in_array(idate('d'), $this->_removeHistoryDays)) { $this->_removeHistory(); } } protected function _closeSessions() { $stmt = $this->_getDataObj()->getUnclosedSessionsStatement(); $countClosed = 0; while ($sessionId = $stmt->fetchColumn()) { if (!$this->_getDataObj()->sessionExists($sessionId)) { $this->_getDataObj()->markSessionClosed($sessionId); $countClosed++; } } App_SanityCheck_View::writeCronLog( $this, 'Closed ' . $countClosed . ' ' . Qs_Translate::getPlural('session', $countClosed) ); return $this; } protected function _removeHistory() { $months = (int) App_Settings_Obj::get('viewControllerLogLiveTime'); if (empty($months)) { App_SanityCheck_View::writeCronLog( $this, 'viewControllerLogLiveTime is empty' ); return $this; } $affectedRows = $this->_getDataObj()->removeHistory($months); App_SanityCheck_View::writeCronLog( $this, 'Removed ' . $affectedRows . ' ' . Qs_Translate::getPlural('session', $affectedRows) . ' older ' . $months . ' ' . Qs_Translate::getPlural('month', $months) ); return $this; } public function setRemoveHistoryDays($removeHistoryDays) { $this->_removeHistoryDays = (array) $removeHistoryDays; return $this; } public function getRemoveHistoryDays() { return $this->_removeHistoryDays; } }