mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Change algorithm to sort out dead users when using Push-Server
This commit is contained in:
parent
9529347589
commit
378a1ab33a
@ -45,6 +45,21 @@ final class ChatUtil {
|
|||||||
*/
|
*/
|
||||||
public static function getDiedUsers() {
|
public static function getDiedUsers() {
|
||||||
$packageID = \wcf\util\ChatUtil::getPackageID();
|
$packageID = \wcf\util\ChatUtil::getPackageID();
|
||||||
|
if (CHAT_SOCKET_IO_PATH && file_exists(WCF_DIR.'acp/be.bastelstu.wcf.chat.serverPush/data.sock')) {
|
||||||
|
$sql = "SELECT
|
||||||
|
time
|
||||||
|
FROM
|
||||||
|
wcf".WCF_N."_chat_message
|
||||||
|
ORDER BY
|
||||||
|
messageID DESC";
|
||||||
|
$stmt = WCF::getDB()->prepareStatement($sql, 1);
|
||||||
|
$stmt->execute();
|
||||||
|
$time = $stmt->fetchColumn();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$time = TIME_NOW;
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
r.userID, r.fieldValue AS roomID
|
r.userID, r.fieldValue AS roomID
|
||||||
FROM
|
FROM
|
||||||
@ -63,7 +78,7 @@ public static function getDiedUsers() {
|
|||||||
OR a.fieldValue IS NULL
|
OR a.fieldValue IS NULL
|
||||||
)";
|
)";
|
||||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||||
$stmt->execute(array('lastActivity', $packageID, 'roomID', $packageID, TIME_NOW - 30));
|
$stmt->execute(array('lastActivity', $packageID, 'roomID', $packageID, $time - 30));
|
||||||
$users = array();
|
$users = array();
|
||||||
while ($users[] = $stmt->fetchArray());
|
while ($users[] = $stmt->fetchArray());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user