From 2c4920ce8aa1a02ac2013a06b033bf3ba06d2120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Tue, 31 Dec 2013 18:24:40 +0100 Subject: [PATCH] - replaced logMessage() with ManiaControl->log - Moved Chatlog DATE constant into plugin class --- application/core/ManiaControl.php | 5 ++--- application/core/Server/Server.php | 6 +++--- application/plugins/Chatlog.php | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/application/core/ManiaControl.php b/application/core/ManiaControl.php index 36b2ea7b..6698ce9b 100644 --- a/application/core/ManiaControl.php +++ b/application/core/ManiaControl.php @@ -64,7 +64,6 @@ class ManiaControl implements CommandListener { */ const VERSION = '0.01'; const API_VERSION = '2013-04-16'; - const DATE = 'd-m-y h:i:sa T'; /** * Public properties @@ -183,7 +182,7 @@ class ManiaControl implements CommandListener { $this->client->Terminate(); } - logMessage('Quitting ManiaControl!'); + $this->log('Quitting ManiaControl!'); exit(); } @@ -191,7 +190,7 @@ class ManiaControl implements CommandListener { * Run ManiaControl */ public function run() { - logMessage('Starting ManiaControl v' . self::VERSION . '!'); + $this->log('Starting ManiaControl v' . self::VERSION . '!'); // Load plugins $this->pluginManager->loadPlugins(); diff --git a/application/core/Server/Server.php b/application/core/Server/Server.php index 700c841c..a37fd934 100644 --- a/application/core/Server/Server.php +++ b/application/core/Server/Server.php @@ -287,14 +287,14 @@ class Server { $waitBegin = time(); $maxWaitTime = 20; $lastStatus = $response['Name']; - logMessage("Waiting for server to reach status {$statusCode}..."); - logMessage("Current Status: {$lastStatus}"); + $this->maniaControl->log("Waiting for server to reach status {$statusCode}..."); + $this->maniaControl->log("Current Status: {$lastStatus}"); while ($response['Code'] !== 4) { sleep(1); $this->maniaControl->client->query('GetStatus'); $response = $this->maniaControl->client->getResponse(); if ($lastStatus !== $response['Name']) { - logMessage("New Status: " . $response['Name']); + $this->maniaControl->log("New Status: " . $response['Name']); $lastStatus = $response['Name']; } if (time() - $maxWaitTime > $waitBegin) { diff --git a/application/plugins/Chatlog.php b/application/plugins/Chatlog.php index 9092fabe..1f182a29 100644 --- a/application/plugins/Chatlog.php +++ b/application/plugins/Chatlog.php @@ -16,6 +16,7 @@ class ChatlogPlugin implements CallbackListener, Plugin { */ const ID = 1; const VERSION = 0.1; + const DATE = 'd-m-y h:i:sa T'; const SETTING_FOLDERNAME = 'Log-Folder Name'; const SETTING_FILENAME = 'Log-File Name'; const SETTING_USEPID = 'Use Process-Id for File Name'; @@ -148,7 +149,7 @@ class ChatlogPlugin implements CallbackListener, Plugin { if (!$login) { $login = ''; } - $message = date(ManiaControl::DATE) . " >> {$login}: {$text}" . PHP_EOL; + $message = date(self::DATE) . " >> {$login}: {$text}" . PHP_EOL; file_put_contents($this->fileName, $message, FILE_APPEND); } }