From 36547eeecad6d54c2d8a53b43fd12e8629fe02d7 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Tue, 24 Jul 2012 16:11:52 +0000 Subject: [PATCH] Fixed cloasing threads by timeout --- src/messenger/webim/libs/chat.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php index 9adf11ad..3742728b 100644 --- a/src/messenger/webim/libs/chat.php +++ b/src/messenger/webim/libs/chat.php @@ -661,10 +661,13 @@ function close_old_threads() $query = "update {chatthread} set lrevision = :next_revision, " . "dtmmodified = CURRENT_TIMESTAMP, istate = :state_closed " . "where istate <> :state_closed and istate <> :state_left " . - "and lastpingagent <> 0 and lastpinguser <> 0 and " . + "and ((lastpingagent <> 0 and lastpinguser <> 0 and " . "(ABS(UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(lastpinguser)) > ". ":thread_lifetime and " . "ABS(UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(lastpingagent)) > ". + ":thread_lifetime)) or " . + "lastpingagent = 0 and lastpinguser <> 0 and " . + "ABS(UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(lastpinguser)) > ". ":thread_lifetime)"; $db->query(