From 4bc538f367d5d148cba0c0f49fc3215a29f7d2ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 11 Aug 2013 17:30:34 +0200 Subject: [PATCH] Extend HourlyCleanUpCronjob instead of an own cronjob --- cronjob.xml | 17 ------ eventListener.xml | 17 ++++++ ...onjobExecuteChatCleanUpListener.class.php} | 56 +++++++++---------- package.xml | 3 +- 4 files changed, 47 insertions(+), 46 deletions(-) delete mode 100644 cronjob.xml create mode 100644 eventListener.xml rename file/lib/system/{cronjob/CleanupCronjob.class.php => event/listener/HourlyCleanUpCronjobExecuteChatCleanUpListener.class.php} (67%) diff --git a/cronjob.xml b/cronjob.xml deleted file mode 100644 index e4e10a6..0000000 --- a/cronjob.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - chat\system\cronjob\CleanupCronjob - Cleans up Tims Chat - */15 - * - * - * - * - 1 - 1 - 0 - - - \ No newline at end of file diff --git a/eventListener.xml b/eventListener.xml new file mode 100644 index 0000000..0d1d3f1 --- /dev/null +++ b/eventListener.xml @@ -0,0 +1,17 @@ + + + + + wcf\system\cronjob\DailyCleanUpCronjob + execute + chat\system\event\listener\HourlyCleanUpCronjobExecuteChatCleanUpListener + user + + + wcf\system\cronjob\DailyCleanUpCronjob + execute + chat\system\event\listener\HourlyCleanUpCronjobExecuteChatCleanUpListener + admin + + + \ No newline at end of file diff --git a/file/lib/system/cronjob/CleanupCronjob.class.php b/file/lib/system/event/listener/HourlyCleanUpCronjobExecuteChatCleanUpListener.class.php similarity index 67% rename from file/lib/system/cronjob/CleanupCronjob.class.php rename to file/lib/system/event/listener/HourlyCleanUpCronjobExecuteChatCleanUpListener.class.php index 5933522..c043388 100644 --- a/file/lib/system/cronjob/CleanupCronjob.class.php +++ b/file/lib/system/event/listener/HourlyCleanUpCronjobExecuteChatCleanUpListener.class.php @@ -1,28 +1,28 @@ - - * @package be.bastelstu.chat - * @subpackage system.cronjob - */ -class CleanupCronjob implements \wcf\system\cronjob\ICronjob { - /** - * @see wcf\system\ICronjob::execute() - */ - public function execute(\wcf\data\cronjob\Cronjob $cronjob) { - $messageAction = new data\message\MessageAction(array(), 'prune'); - $messageAction->executeAction(); - $roomAction = new data\room\RoomAction(array(), 'prune'); - $roomAction->executeAction(); - - // kill dead users - $roomAction = new data\room\RoomAction(array(), 'removeDeadUsers'); - $roomAction->executeAction(); - } -} + + * @package be.bastelstu.chat + * @subpackage system.event.listener + */ +class HourlyCleanUpCronjobExecuteChatCleanUpListener implements IEventListener { + /** + * @see \wcf\system\event\IEventListener::execute() + */ + public function execute($eventObj, $className, $eventName) { + $messageAction = new data\message\MessageAction(array(), 'prune'); + $messageAction->executeAction(); + $roomAction = new data\room\RoomAction(array(), 'prune'); + $roomAction->executeAction(); + + // kill dead users + $roomAction = new data\room\RoomAction(array(), 'removeDeadUsers'); + $roomAction->executeAction(); + } +} diff --git a/package.xml b/package.xml index a334d00..a0bb007 100644 --- a/package.xml +++ b/package.xml @@ -34,7 +34,7 @@ aclOption.xml acpMenu.xml userGroupOption.xml - cronjob.xml + eventListener.xml dashboardBox.xml acp/be.bastelstu.chat.install.php @@ -51,6 +51,7 @@ aclOption.xml acpMenu.xml userGroupOption.xml + eventListener.xml dashboardBox.xml acp/be.bastelstu.chat.update.php