From 0bf4293977d98d6c6d54c67bc423d8de70e238a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 4 Mar 2012 15:38:25 +0100 Subject: [PATCH] Adding Update-Script It sends a notice to every room that the chat was updated. --- file/acp/timwolla.wcf.chat.update.php | 33 +++++++++++++++++++++++++++ package.xml | 3 ++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 file/acp/timwolla.wcf.chat.update.php diff --git a/file/acp/timwolla.wcf.chat.update.php b/file/acp/timwolla.wcf.chat.update.php new file mode 100644 index 0000000..5f5ea67 --- /dev/null +++ b/file/acp/timwolla.wcf.chat.update.php @@ -0,0 +1,33 @@ + + * @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(); diff --git a/package.xml b/package.xml index 0c492f9..476b275 100644 --- a/package.xml +++ b/package.xml @@ -5,7 +5,7 @@ 0 1 - 3.0.0 Alpha 7 + 3.0.0 Alpha 8 2011-11-26 com.woltlab.wcf.bbcode @@ -50,5 +50,6 @@ acloptions.xml acpMenu.xml userGroupOption.xml + acp/timwolla.wcf.chat.update.php