mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Clean Up dead users by cronjob as well.
This commit is contained in:
parent
0b1ad7a02a
commit
8dcd287fb4
@ -4,7 +4,7 @@
|
|||||||
<cronjob>
|
<cronjob>
|
||||||
<classname>wcf\system\cronjob\ChatCleanupCronjob</classname>
|
<classname>wcf\system\cronjob\ChatCleanupCronjob</classname>
|
||||||
<description>Cleans up Tims Chat</description>
|
<description>Cleans up Tims Chat</description>
|
||||||
<startminute>*/30</startminute>
|
<startminute>*/15</startminute>
|
||||||
<starthour>*</starthour>
|
<starthour>*</starthour>
|
||||||
<startdom>*</startdom>
|
<startdom>*</startdom>
|
||||||
<startmonth>*</startmonth>
|
<startmonth>*</startmonth>
|
||||||
|
@ -17,5 +17,31 @@ class ChatCleanupCronjob implements ICronjob {
|
|||||||
public function execute(\wcf\data\cronjob\Cronjob $cronjob) {
|
public function execute(\wcf\data\cronjob\Cronjob $cronjob) {
|
||||||
\wcf\data\chat\message\ChatMessageEditor::prune();
|
\wcf\data\chat\message\ChatMessageEditor::prune();
|
||||||
\wcf\data\chat\room\ChatRoomEditor::prune();
|
\wcf\data\chat\room\ChatRoomEditor::prune();
|
||||||
|
|
||||||
|
// kill dead users
|
||||||
|
$deadUsers = \wcf\util\ChatUtil::getDiedUsers();
|
||||||
|
foreach ($deadUsers as $deadUser) {
|
||||||
|
if (!$deadUser) continue;
|
||||||
|
|
||||||
|
$user = new \wcf\data\user\User($deadUser['userID']);
|
||||||
|
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
||||||
|
$userData['color'] = \wcf\util\ChatUtil::readUserData('color', $user);
|
||||||
|
|
||||||
|
$messageAction = new chat\message\ChatMessageAction(array(), 'create', array(
|
||||||
|
'data' => array(
|
||||||
|
'roomID' => $deadUser['roomID'],
|
||||||
|
'sender' => $user->userID,
|
||||||
|
'username' => $user->username,
|
||||||
|
'time' => TIME_NOW,
|
||||||
|
'type' => chat\message\ChatMessage::TYPE_LEAVE,
|
||||||
|
'message' => '',
|
||||||
|
'color1' => $userData['color'][1],
|
||||||
|
'color2' => $userData['color'][2]
|
||||||
|
)
|
||||||
|
));
|
||||||
|
$messageAction->executeAction();
|
||||||
|
}
|
||||||
|
\wcf\util\ChatUtil::writeUserData(array('roomID' => null), $user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user