1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-10 17:45:18 +02:00

[ticket/16470] Adjust user last visit time update logic

Previous logic doesn't work correctly as session_time value got updated
in regular manner, so that its 60 seconds lag with time_now
can be unreachable in some cases. So update user_lastvisit if it lags
for 60 sec of session_time.

PHPBB3-16470
PHPBB3-14173
This commit is contained in:
rxu 2023-06-17 00:46:38 +07:00
parent a14e8f8ce5
commit 9e55d3cb44
No known key found for this signature in database
GPG Key ID: 955F0567380E586A

View File

@ -441,7 +441,7 @@ class session
$this->check_ban_for_current_session($config);
// Update user last visit time accordingly, but in a minute or so
if ($this->time_now - $this->data['session_time'] > 60)
if ((int) $this->data['session_time'] - (int) $this->data['user_lastvisit'] > 60)
{
$this->update_user_lastvisit();
}
@ -691,7 +691,7 @@ class session
$this->session_id = $this->data['session_id'];
// Only sync user last visit time in a minute or so after last session data update or if the page changes
if ($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page']))
if ((int) $this->data['session_time'] - (int) $this->data['user_lastvisit'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page']))
{
// Update the last visit time
$this->update_user_lastvisit();