1
0
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:
Tim Düsterhus 2012-10-20 18:24:48 +02:00
parent 0587fdfa0f
commit ea3b0f69cf
2 changed files with 28 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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();