1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Adding Update-Script

It sends a notice to every room that the chat was updated.
This commit is contained in:
Tim Düsterhus 2012-03-04 15:38:25 +01:00
parent 7e616fed77
commit 0bf4293977
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,33 @@
<?php
namespace timwolla\wcf\chat;
/**
* Handles updates.
*
* @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat
*/
final class Update {
private $rooms = null;
public function __construct() {
$this->rooms = \wcf\data\chat\room\ChatRoom::getCache();
}
public function execute() {
foreach ($this->rooms as $room) {
$messageAction = new \wcf\data\chat\message\ChatMessageAction(array(), 'create', array(
'data' => array(
'roomID' => $room->roomID,
'time' => TIME_NOW,
'type' => \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION,
'message' => 'Tims Chat was updated. Please refresh the page.'
)
));
$messageAction->executeAction();
}
}
}
$update = new Update();
$update->execute();

View File

@ -5,7 +5,7 @@
<packagedescription><![CDATA[Chat for WoltLab Community Framework™]]></packagedescription> <packagedescription><![CDATA[Chat for WoltLab Community Framework™]]></packagedescription>
<standalone>0</standalone> <standalone>0</standalone>
<isunique>1</isunique> <isunique>1</isunique>
<version>3.0.0 Alpha 7</version> <version>3.0.0 Alpha 8</version>
<date>2011-11-26</date> <date>2011-11-26</date>
<plugin>com.woltlab.wcf.bbcode</plugin> <!-- TODO: Correct me --> <plugin>com.woltlab.wcf.bbcode</plugin> <!-- TODO: Correct me -->
</packageinformation> </packageinformation>
@ -50,5 +50,6 @@
<instruction type="aclOption">acloptions.xml</instruction> <instruction type="aclOption">acloptions.xml</instruction>
<instruction type="acpMenu">acpMenu.xml</instruction> <instruction type="acpMenu">acpMenu.xml</instruction>
<instruction type="userGroupOption">userGroupOption.xml</instruction> <instruction type="userGroupOption">userGroupOption.xml</instruction>
<instruction type="script">acp/timwolla.wcf.chat.update.php</instruction>
</instructions> </instructions>
</package> </package>