1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Extend HourlyCleanUpCronjob instead of an own cronjob

This commit is contained in:
Tim Düsterhus 2013-08-11 17:30:34 +02:00
parent e752a58ff7
commit 4bc538f367
4 changed files with 47 additions and 46 deletions

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/cronjob.xsd">
<import>
<cronjob>
<classname>chat\system\cronjob\CleanupCronjob</classname>
<description>Cleans up Tims Chat</description>
<startminute>*/15</startminute>
<starthour>*</starthour>
<startdom>*</startdom>
<startmonth>*</startmonth>
<startdow>*</startdow>
<active>1</active>
<canbeedited>1</canbeedited>
<canbedisabled>0</canbedisabled>
</cronjob>
</import>
</data>

17
eventListener.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/eventListener.xsd">
<import>
<eventlistener>
<eventclassname>wcf\system\cronjob\DailyCleanUpCronjob</eventclassname>
<eventname>execute</eventname>
<listenerclassname>chat\system\event\listener\HourlyCleanUpCronjobExecuteChatCleanUpListener</listenerclassname>
<environment>user</environment>
</eventlistener>
<eventlistener>
<eventclassname>wcf\system\cronjob\DailyCleanUpCronjob</eventclassname>
<eventname>execute</eventname>
<listenerclassname>chat\system\event\listener\HourlyCleanUpCronjobExecuteChatCleanUpListener</listenerclassname>
<environment>admin</environment>
</eventlistener>
</import>
</data>

View File

@ -1,5 +1,5 @@
<?php
namespace chat\system\cronjob;
namespace chat\system\event\listener;
use \chat\data;
/**
@ -9,13 +9,13 @@
* @copyright 2010-2013 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package be.bastelstu.chat
* @subpackage system.cronjob
* @subpackage system.event.listener
*/
class CleanupCronjob implements \wcf\system\cronjob\ICronjob {
class HourlyCleanUpCronjobExecuteChatCleanUpListener implements IEventListener {
/**
* @see wcf\system\ICronjob::execute()
* @see \wcf\system\event\IEventListener::execute()
*/
public function execute(\wcf\data\cronjob\Cronjob $cronjob) {
public function execute($eventObj, $className, $eventName) {
$messageAction = new data\message\MessageAction(array(), 'prune');
$messageAction->executeAction();
$roomAction = new data\room\RoomAction(array(), 'prune');

View File

@ -34,7 +34,7 @@
<instruction type="aclOption">aclOption.xml</instruction>
<instruction type="acpMenu">acpMenu.xml</instruction>
<instruction type="userGroupOption">userGroupOption.xml</instruction>
<instruction type="cronjob">cronjob.xml</instruction>
<instruction type="eventListener">eventListener.xml</instruction>
<instruction type="dashboardBox">dashboardBox.xml</instruction>
<instruction type="script" run="standalone">acp/be.bastelstu.chat.install.php</instruction>
</instructions>
@ -51,6 +51,7 @@
<instruction type="aclOption">aclOption.xml</instruction>
<instruction type="acpMenu">acpMenu.xml</instruction>
<instruction type="userGroupOption">userGroupOption.xml</instruction>
<instruction type="eventListener">eventListener.xml</instruction>
<instruction type="dashboardBox">dashboardBox.xml</instruction>
<instruction type="script" run="standalone">acp/be.bastelstu.chat.update.php</instruction>
</instructions>