From 85eceeccbee4cac37b73c6b40bac22ad6edb5bbd Mon Sep 17 00:00:00 2001 From: kasimi Date: Fri, 9 Mar 2018 23:31:57 +0100 Subject: [PATCH 1/2] [ticket/15583] Update session time in AJAX request only once a minute PHPBB3-15583 --- phpBB/phpbb/session.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index de9345ca85..654d377d31 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1614,13 +1614,15 @@ class session return; } + // Do not update the session page for ajax requests, so the view online still works as intended + $page_changed = $this->update_session_page && $this->data['session_page'] != $this->page['page'] && !$request->is_ajax(); + // Only update session DB a minute or so after last update or if page changes - if ($this->time_now - ((isset($this->data['session_time'])) ? $this->data['session_time'] : 0) > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) + if ($this->time_now - ((isset($this->data['session_time'])) ? $this->data['session_time'] : 0) > 60 || $page_changed) { $sql_ary = array('session_time' => $this->time_now); - // Do not update the session page for ajax requests, so the view online still works as intended - if ($this->update_session_page && !$request->is_ajax()) + if ($page_changed) { $sql_ary['session_page'] = substr($this->page['page'], 0, 199); $sql_ary['session_forum_id'] = $this->page['forum']; From 8283f2393af3742f81daeb1c92d4ea097e8863e3 Mon Sep 17 00:00:00 2001 From: kasimi Date: Wed, 6 Jun 2018 10:40:29 +0200 Subject: [PATCH 2/2] [ticket/15583] Update session time in AJAX request only once a minute PHPBB3-15583 --- phpBB/phpbb/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 654d377d31..80934dc411 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1618,7 +1618,7 @@ class session $page_changed = $this->update_session_page && $this->data['session_page'] != $this->page['page'] && !$request->is_ajax(); // Only update session DB a minute or so after last update or if page changes - if ($this->time_now - ((isset($this->data['session_time'])) ? $this->data['session_time'] : 0) > 60 || $page_changed) + if ($this->time_now - (isset($this->data['session_time']) ? $this->data['session_time'] : 0) > 60 || $page_changed) { $sql_ary = array('session_time' => $this->time_now);