From c8979afbffda7ca7689c6816bdec4c53c4d15c32 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Sun, 5 Apr 2009 14:11:44 +0000 Subject: [PATCH] improve users.php loading speed (major fix) git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@455 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/webim/operator/update.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/messenger/webim/operator/update.php b/src/messenger/webim/operator/update.php index 42c35b4f..d9ac3250 100644 --- a/src/messenger/webim/operator/update.php +++ b/src/messenger/webim/operator/update.php @@ -104,7 +104,7 @@ function thread_to_xml($thread,$link) { } function print_pending_threads($groupids,$since) { - global $webim_encoding, $settings; + global $webim_encoding, $settings, $state_closed; $link = connect(); $revision = $since; @@ -112,6 +112,9 @@ function print_pending_threads($groupids,$since) { $query = "select threadid, userName, agentName, unix_timestamp(dtmcreated), userTyping, ". "unix_timestamp(dtmmodified), lrevision, istate, remote, nextagent, agentId, userid, shownmessageid, userAgent, (select vclocalname from chatgroup where chatgroup.groupid = chatthread.groupid) as groupname ". "from chatthread where lrevision > $since ". + ($since <= 0 + ? "AND istate <> $state_closed " + : ""). ($settings['enablegroups'] == '1' ? "AND (groupid is NULL".($groupids ? " OR groupid IN ($groupids)"