mirror of
https://github.com/Mibew/java.git
synced 2024-11-15 09:24:12 +03:00
Fix bug with old threads closing
This commit is contained in:
parent
ab8a889464
commit
a899cc2dff
@ -370,14 +370,43 @@ Class Thread {
|
|||||||
|
|
||||||
$db = Database::getInstance();
|
$db = Database::getInstance();
|
||||||
|
|
||||||
$query = "update {chatthread} set lrevision = :next_revision, " .
|
$query = "UPDATE {chatthread} SET " .
|
||||||
"dtmmodified = :now, dtmclosed = :now, istate = :state_closed " .
|
"lrevision = :next_revision, " .
|
||||||
"where istate <> :state_closed and istate <> :state_left " .
|
"dtmmodified = :now, " .
|
||||||
"and ((lastpingagent <> 0 and lastpinguser <> 0 and " .
|
"dtmclosed = :now, " .
|
||||||
"(ABS(:now - lastpinguser) > :thread_lifetime and " .
|
"istate = :state_closed " .
|
||||||
"ABS(:now - lastpingagent) > :thread_lifetime)) or " .
|
"WHERE istate <> :state_closed " .
|
||||||
"(lastpingagent = 0 and lastpinguser <> 0 and " .
|
"AND istate <> :state_left " .
|
||||||
"ABS(:now - lastpinguser) > :thread_lifetime))";
|
// Check created timestamp
|
||||||
|
"AND ABS(:now - dtmcreated) > :thread_lifetime " .
|
||||||
|
// Check pings
|
||||||
|
"AND ( " .
|
||||||
|
"( " .
|
||||||
|
// Both user and operator have no connection problems.
|
||||||
|
// Check all pings.
|
||||||
|
"lastpingagent <> 0 " .
|
||||||
|
"AND lastpinguser <> 0 " .
|
||||||
|
"AND ABS(:now - lastpinguser) > :thread_lifetime " .
|
||||||
|
"AND ABS(:now - lastpingagent) > :thread_lifetime " .
|
||||||
|
") OR ( " .
|
||||||
|
// Only operator have connection problems.
|
||||||
|
// Check user's ping.
|
||||||
|
"lastpingagent = 0 " .
|
||||||
|
"AND lastpinguser <> 0 " .
|
||||||
|
"AND ABS(:now - lastpinguser) > :thread_lifetime " .
|
||||||
|
") OR ( " .
|
||||||
|
// Only user have connection problems.
|
||||||
|
// Check operator's ping.
|
||||||
|
"lastpinguser = 0 " .
|
||||||
|
"AND lastpingagent <> 0 " .
|
||||||
|
"AND ABS(:now - lastpingagent) > :thread_lifetime " .
|
||||||
|
") OR ( " .
|
||||||
|
// Both user and operator have connection problems.
|
||||||
|
// Just close thread.
|
||||||
|
"lastpinguser = 0 " .
|
||||||
|
"AND lastpingagent = 0 " .
|
||||||
|
") " .
|
||||||
|
")";
|
||||||
|
|
||||||
$db->query(
|
$db->query(
|
||||||
$query,
|
$query,
|
||||||
|
Loading…
Reference in New Issue
Block a user