diff options
author | plegall <plg@piwigo.org> | 2016-07-04 15:47:02 +0200 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2016-07-04 15:47:02 +0200 |
commit | 724befb35d0edb0727ec511f9cf8086b36e12f8d (patch) | |
tree | ec7750d394cd69cd5c2e626f646b36a1a7efa0c7 /include/functions.inc.php | |
parent | 27c2871ca27adf24503f953fa05e9ca9d027eb76 (diff) |
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.
Diffstat (limited to '')
-rw-r--r-- | include/functions.inc.php | 6 |
1 files changed, 5 insertions, 1 deletions
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) |