From 724befb35d0edb0727ec511f9cf8086b36e12f8d Mon Sep 17 00:00:00 2001 From: plegall Date: Mon, 4 Jul 2016 15:47:02 +0200 Subject: feature #478, improve performances By reducing frequency of update on user_infos.last_visit. Instead of updating on each page visit, we wait at least a session length, which is 30 minutes by default. @modus75 suggested to use function log_user instead, which is a better design. Unfortunately it would lead to much less accuracy, because on many systems PHP sessions are never purged (Debian with default settings). It would be possible to come back everyday and never update the last_visit, as long as the web browser is not closed. --- include/functions.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/functions.inc.php') diff --git a/include/functions.inc.php b/include/functions.inc.php index 5cef77f62..a7135a4f4 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -411,7 +411,11 @@ function pwg_log($image_id = null, $image_type = null, $format_id = null) { global $conf, $user, $page; - $update_last_visit = true; + $update_last_visit = false; + if (empty($user['last_visit']) or strtotime($user['last_visit']) < time()-$conf['session_length']) + { + $update_last_visit = true; + } $update_last_visit = trigger_change('pwg_log_update_last_visit', $update_last_visit); if ($update_last_visit) -- cgit v1.2.3