Tims-Chat/files/lib/system/event/listener/HourlyCleanUpCronjobExecute...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.3 KiB
PHP
Raw Normal View History

2018-08-16 22:30:59 +00:00
<?php
/*
2021-02-04 22:04:35 +00:00
* Copyright (c) 2010-2021 Tim Düsterhus.
2018-08-16 22:30:59 +00:00
*
* Use of this software is governed by the Business Source License
* included in the LICENSE file.
*
* Change Date: 2026-03-04
2018-08-16 22:30:59 +00:00
*
* On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2
* or later of the General Public License.
*/
namespace chat\system\event\listener;
use \wcf\system\WCF;
/**
* Vaporizes unneeded data.
*/
class HourlyCleanUpCronjobExecuteChatCleanUpListener implements \wcf\system\event\listener\IParameterizedEventListener {
/**
* @see \wcf\system\event\listener\IParameterizedEventListener::execute()
*/
public function execute($eventObj, $className, $eventName, array &$parameters) {
(new \chat\data\message\MessageAction([ ], 'prune'))->executeAction();
(new \chat\data\user\UserAction([], 'clearDeadSessions'))->executeAction();
$sql = "UPDATE chat1_room_to_user
2018-08-16 22:30:59 +00:00
SET active = ?
WHERE (roomID, userID) NOT IN (SELECT roomID, userID FROM chat1_session)
2018-08-16 22:30:59 +00:00
AND active = ?";
$statement = WCF::getDB()->prepare($sql);
2018-08-16 22:30:59 +00:00
$statement->execute([ 0, 1 ]);
if ($statement->getAffectedRows()) {
\wcf\functions\exception\logThrowable(new \Exception('Unreachable'));
}
}
}