mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2025-01-22 02:00:40 +00:00
Add suspensions to cronjob and add getSuspensionByUserRoomAndType
This commit is contained in:
parent
0587fdfa0f
commit
ea3b0f69cf
@ -49,4 +49,29 @@ class ChatSuspension extends \wcf\data\DatabaseObject {
|
||||
|
||||
return $suspensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the appropriate suspension for user, room and type.
|
||||
*
|
||||
* @param \wcf\data\user\User $user
|
||||
* @param \wcf\data\chat\room\ChatRoom $room
|
||||
* @param integer $type
|
||||
* @return \wcf\data\chat\suspension\ChatSuspension
|
||||
*/
|
||||
public static function getSuspensionByUserRoomAndType(\wcf\data\user\User $user, \wcf\data\chat\room\ChatRoom $room, $type) {
|
||||
$sql = "SELECT
|
||||
*
|
||||
FROM
|
||||
wcf".WCF_N."_user_group_application
|
||||
WHERE
|
||||
userID = ?
|
||||
AND roomID = ?
|
||||
AND type = ?";
|
||||
$statement = WCF::getDB()->prepareStatement($sql);
|
||||
$statement->execute(array($user->userID, $room->roomID, $type));
|
||||
$row = $statement->fetchArray();
|
||||
if(!$row) $row = array();
|
||||
|
||||
return new self(null, $row);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,9 @@ class ChatCleanupCronjob implements ICronjob {
|
||||
$messageAction->executeAction();
|
||||
$roomAction = new chat\room\ChatRoomAction(array(), 'prune');
|
||||
$roomAction->executeAction();
|
||||
$suspensionAction = new chat\suspension\ChatSuspensionAction(array(), 'prune');
|
||||
$suspensionAction->executeAction();
|
||||
|
||||
|
||||
// kill dead users
|
||||
$deadUsers = \wcf\util\ChatUtil::getDiedUsers();
|
||||
|
Loading…
x
Reference in New Issue
Block a user