diff options
author | Tristan Darricau <tristan.darricau@gmail.com> | 2018-07-08 18:06:16 +0200 |
---|---|---|
committer | Tristan Darricau <tristan.darricau@gmail.com> | 2018-07-08 18:06:16 +0200 |
commit | 777443d95c3fbbfb9fce942f3fd5fad397f610ea (patch) | |
tree | 0246a77b6e52b1752c33dd3beb68b606c5966596 | |
parent | 9db4983f0349e465d4e2ba4e033173858b641f74 (diff) | |
parent | 8283f2393af3742f81daeb1c92d4ea097e8863e3 (diff) | |
download | forums-777443d95c3fbbfb9fce942f3fd5fad397f610ea.tar forums-777443d95c3fbbfb9fce942f3fd5fad397f610ea.tar.gz forums-777443d95c3fbbfb9fce942f3fd5fad397f610ea.tar.bz2 forums-777443d95c3fbbfb9fce942f3fd5fad397f610ea.tar.xz forums-777443d95c3fbbfb9fce942f3fd5fad397f610ea.zip |
Merge pull request #5157 from kasimi/ticket/15583
[ticket/15583] Update session time in AJAX request only once a minute
* github.com:/phpbb/phpbb:
[ticket/15583] Update session time in AJAX request only once a minute
[ticket/15583] Update session time in AJAX request only once a minute
-rw-r--r-- | phpBB/phpbb/session.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index de9345ca85..80934dc411 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']; |