mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Fix chat room pruning
This commit is contained in:
parent
0f4b99da26
commit
47bce1e4aa
@ -69,16 +69,12 @@ public function prune() {
|
|||||||
WHERE
|
WHERE
|
||||||
permanent = ?
|
permanent = ?
|
||||||
AND roomID NOT IN (
|
AND roomID NOT IN (
|
||||||
SELECT
|
SELECT chatRoomID
|
||||||
fieldValue AS roomID
|
FROM wcf".WCF_N."_user
|
||||||
FROM
|
WHERE chatRoomID IS NOT NULL
|
||||||
wcf".WCF_N."_user_storage
|
|
||||||
WHERE
|
|
||||||
field = ?
|
|
||||||
AND fieldValue IS NOT NULL
|
|
||||||
)";
|
)";
|
||||||
$stmt = \wcf\system\WCF::getDB()->prepareStatement($sql);
|
$stmt = \wcf\system\WCF::getDB()->prepareStatement($sql);
|
||||||
$stmt->execute(array(0, 'roomID'));
|
$stmt->execute(array(0));
|
||||||
$objectIDs = array();
|
$objectIDs = array();
|
||||||
|
|
||||||
while ($objectID = $stmt->fetchColumn()) $objectIDs[] = $objectID;
|
while ($objectID = $stmt->fetchColumn()) $objectIDs[] = $objectID;
|
||||||
@ -251,7 +247,7 @@ public function join() {
|
|||||||
\wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.join', $result, WCF::getUser()->userID);
|
\wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.join', $result, WCF::getUser()->userID);
|
||||||
|
|
||||||
// send push message about join
|
// send push message about join
|
||||||
\wcf\system\nodePush\NodePushHandler::getInstance()->sendMessage('be.bastelstu.chat.join');
|
\wcf\system\push\PushHandler::getInstance()->sendMessage('be.bastelstu.chat.join');
|
||||||
|
|
||||||
$messages = array();
|
$messages = array();
|
||||||
foreach ($newestMessages as $message) $messages[] = $message->jsonify(true);
|
foreach ($newestMessages as $message) $messages[] = $message->jsonify(true);
|
||||||
@ -318,7 +314,7 @@ public function leave() {
|
|||||||
'chatRoomID' => null
|
'chatRoomID' => null
|
||||||
));
|
));
|
||||||
|
|
||||||
\wcf\system\nodePush\NodePushHandler::getInstance()->sendMessage('be.bastelstu.chat.leave');
|
\wcf\system\push\PushHandler::getInstance()->sendMessage('be.bastelstu.chat.leave');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace chat\util;
|
namespace chat\util;
|
||||||
use \wcf\data\package\PackageCache;
|
use \wcf\data\package\PackageCache;
|
||||||
use \wcf\system\user\storage\UserStorageHandler;
|
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user