replaced ManiaControl log method by direct Logger usage
This commit is contained in:
		| @@ -4,6 +4,7 @@ namespace ManiaControl\Admin; | |||||||
|  |  | ||||||
| use ManiaControl\Callbacks\CallbackListener; | use ManiaControl\Callbacks\CallbackListener; | ||||||
| use ManiaControl\Callbacks\Callbacks; | use ManiaControl\Callbacks\Callbacks; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Players\Player; | use ManiaControl\Players\Player; | ||||||
| use ManiaControl\Players\PlayerManager; | use ManiaControl\Players\PlayerManager; | ||||||
| @@ -147,7 +148,7 @@ class AuthenticationManager implements CallbackListener { | |||||||
| 	private function updateMasterAdmins() { | 	private function updateMasterAdmins() { | ||||||
| 		$masterAdminsElements = $this->maniaControl->getConfig()->xpath('masteradmins'); | 		$masterAdminsElements = $this->maniaControl->getConfig()->xpath('masteradmins'); | ||||||
| 		if (!$masterAdminsElements) { | 		if (!$masterAdminsElements) { | ||||||
| 			$this->maniaControl->log('Missing MasterAdmins configuration!', true); | 			Logger::logError('Missing MasterAdmins configuration!'); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		$masterAdminsElement = $masterAdminsElements[0]; | 		$masterAdminsElement = $masterAdminsElements[0]; | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ use FML\Script\Script; | |||||||
| use ManiaControl\Admin\AuthenticationManager; | use ManiaControl\Admin\AuthenticationManager; | ||||||
| use ManiaControl\Callbacks\CallbackListener; | use ManiaControl\Callbacks\CallbackListener; | ||||||
| use ManiaControl\Callbacks\Callbacks; | use ManiaControl\Callbacks\Callbacks; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Players\Player; | use ManiaControl\Players\Player; | ||||||
| use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; | use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; | ||||||
| @@ -389,7 +390,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
|  |  | ||||||
| 		$chatMessage .= '!'; | 		$chatMessage .= '!'; | ||||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		Logger::logInfo($chatMessage, true, true, true); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -128,7 +128,7 @@ class Database implements TimerListener { | |||||||
| 		if ($result) { | 		if ($result) { | ||||||
| 			return true; | 			return true; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->log("Database '{$this->config->name}' doesn't exist! Trying to create it..."); | 		Logger::logInfo("Database '{$this->config->name}' doesn't exist! Trying to create it..."); | ||||||
|  |  | ||||||
| 		// Create database | 		// Create database | ||||||
| 		$databaseQuery = "CREATE DATABASE " . $this->getMysqli()->escape_string($this->config->name) . ";"; | 		$databaseQuery = "CREATE DATABASE " . $this->getMysqli()->escape_string($this->config->name) . ";"; | ||||||
|   | |||||||
| @@ -109,7 +109,7 @@ class ErrorHandler { | |||||||
| 		if (!$isUserError && $traceString) { | 		if (!$isUserError && $traceString) { | ||||||
| 			$logMessage .= PHP_EOL . 'Trace: ' . PHP_EOL . $traceString; | 			$logMessage .= PHP_EOL . 'Trace: ' . PHP_EOL . $traceString; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->log($logMessage); | 		Logger::log($logMessage); | ||||||
|  |  | ||||||
| 		if (!DEV_MODE && !$isUserError && !$suppressed) { | 		if (!DEV_MODE && !$isUserError && !$suppressed) { | ||||||
| 			// Report error | 			// Report error | ||||||
| @@ -434,7 +434,7 @@ class ErrorHandler { | |||||||
| 		$traceString    = $this->parseBackTrace($exception->getTrace(), $sourceClass); | 		$traceString    = $this->parseBackTrace($exception->getTrace(), $sourceClass); | ||||||
|  |  | ||||||
| 		$logMessage = $message . PHP_EOL . 'Class: ' . $exceptionClass . PHP_EOL . 'Trace:' . PHP_EOL . $traceString; | 		$logMessage = $message . PHP_EOL . 'Class: ' . $exceptionClass . PHP_EOL . 'Trace:' . PHP_EOL . $traceString; | ||||||
| 		$this->maniaControl->log($logMessage); | 		Logger::log($logMessage); | ||||||
|  |  | ||||||
| 		if (!DEV_MODE) { | 		if (!DEV_MODE) { | ||||||
| 			$report                    = array(); | 			$report                    = array(); | ||||||
|   | |||||||
| @@ -131,7 +131,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 	 * Construct a new ManiaControl instance | 	 * Construct a new ManiaControl instance | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct() { | 	public function __construct() { | ||||||
| 		$this->log('Loading ManiaControl v' . self::VERSION . ' ...'); | 		Logger::log('Loading ManiaControl v' . self::VERSION . ' ...'); | ||||||
|  |  | ||||||
| 		$this->errorHandler = new ErrorHandler($this); | 		$this->errorHandler = new ErrorHandler($this); | ||||||
|  |  | ||||||
| @@ -446,10 +446,10 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
|  |  | ||||||
| 		// Announce restart | 		// Announce restart | ||||||
| 		if ($message) { | 		if ($message) { | ||||||
| 			$this->log($message); | 			Logger::log($message); | ||||||
| 		} | 		} | ||||||
| 		$this->getChat()->sendInformation('Restarting ManiaControl...'); | 		$this->getChat()->sendInformation('Restarting ManiaControl...'); | ||||||
| 		$this->log('Restarting ManiaControl!'); | 		Logger::log('Restarting ManiaControl!'); | ||||||
|  |  | ||||||
| 		// Hide widgets | 		// Hide widgets | ||||||
| 		if ($this->getClient()) { | 		if ($this->getClient()) { | ||||||
| @@ -490,7 +490,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 	 * Run ManiaControl | 	 * Run ManiaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function run() { | 	public function run() { | ||||||
| 		$this->log('Starting ManiaControl v' . self::VERSION . '!'); | 		Logger::log('Starting ManiaControl v' . self::VERSION . '!'); | ||||||
|  |  | ||||||
| 		// Connect to server | 		// Connect to server | ||||||
| 		try { | 		try { | ||||||
| @@ -519,8 +519,8 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 		$this->getCallbackManager()->triggerCallback(Callbacks::AFTERINIT); | 		$this->getCallbackManager()->triggerCallback(Callbacks::AFTERINIT); | ||||||
|  |  | ||||||
| 		// Loading finished | 		// Loading finished | ||||||
| 		$this->log('Loading completed!'); | 		Logger::log('Loading completed!'); | ||||||
| 		$this->log('Link: '.$this->getServer()->getJoinLink()); | 		Logger::log('Link: '.$this->getServer()->getJoinLink()); | ||||||
| 		$this->getChat()->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!'); | 		$this->getChat()->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!'); | ||||||
|  |  | ||||||
| 		// Main loop | 		// Main loop | ||||||
| @@ -539,7 +539,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 		// Load remote client | 		// Load remote client | ||||||
| 		$serverConfig = $this->getServer()->loadConfig(); | 		$serverConfig = $this->getServer()->loadConfig(); | ||||||
|  |  | ||||||
| 		$this->log("Connecting to Server at {$serverConfig->host}:{$serverConfig->port}..."); | 		Logger::log("Connecting to Server at {$serverConfig->host}:{$serverConfig->port}..."); | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->client = Connection::factory($serverConfig->host, $serverConfig->port, self::SCRIPT_TIMEOUT, $serverConfig->user, $serverConfig->pass, self::API_VERSION); | 			$this->client = Connection::factory($serverConfig->host, $serverConfig->port, self::SCRIPT_TIMEOUT, $serverConfig->user, $serverConfig->pass, self::API_VERSION); | ||||||
| @@ -560,7 +560,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Connect finished | 		// Connect finished | ||||||
| 		$this->log('Server Connection successfully established!'); | 		Logger::log('Server Connection successfully established!'); | ||||||
|  |  | ||||||
| 		// Hide old widgets | 		// Hide old widgets | ||||||
| 		$this->getClient()->sendHideManialinkPage(); | 		$this->getClient()->sendHideManialinkPage(); | ||||||
| @@ -582,7 +582,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 		try { | 		try { | ||||||
| 			$this->getCallbackManager()->manageCallbacks(); | 			$this->getCallbackManager()->manageCallbacks(); | ||||||
| 		} catch (TransportException $e) { | 		} catch (TransportException $e) { | ||||||
| 			$this->log('Connection interrupted!'); | 			Logger::logError('Connection interrupted!'); | ||||||
| 			$this->quit($e->getMessage(), true); | 			$this->quit($e->getMessage(), true); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -11,6 +11,7 @@ use FML\Controls\Quads\Quad_UIConstruction_Buttons; | |||||||
| use FML\Controls\Quads\Quad_UIConstructionBullet_Buttons; | use FML\Controls\Quads\Quad_UIConstructionBullet_Buttons; | ||||||
| use FML\ManiaLink; | use FML\ManiaLink; | ||||||
| use FML\Script\Features\Paging; | use FML\Script\Features\Paging; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Manialinks\ManialinkManager; | use ManiaControl\Manialinks\ManialinkManager; | ||||||
| use ManiaControl\Manialinks\ManialinkPageAnswerListener; | use ManiaControl\Manialinks\ManialinkPageAnswerListener; | ||||||
| @@ -399,7 +400,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { | |||||||
| 		// Message | 		// Message | ||||||
| 		$message = $player->getEscapedNickname() . ' added ' . $map->getEscapedName() . '!'; | 		$message = $player->getEscapedNickname() . ' added ' . $map->getEscapedName() . '!'; | ||||||
| 		$this->maniaControl->getChat()->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 		$this->maniaControl->log($message, true); | 		Logger::logInfo($message, true, true, true); | ||||||
|  |  | ||||||
| 		// Queue requested Map | 		// Queue requested Map | ||||||
| 		$this->maniaControl->getMapManager()->getMapQueue()->addMapToMapQueue($player, $map); | 		$this->maniaControl->getMapManager()->getMapQueue()->addMapToMapQueue($player, $map); | ||||||
|   | |||||||
| @@ -9,6 +9,7 @@ use ManiaControl\Admin\AuthenticationManager; | |||||||
| use ManiaControl\Callbacks\CallbackListener; | use ManiaControl\Callbacks\CallbackListener; | ||||||
| use ManiaControl\Callbacks\CallbackManager; | use ManiaControl\Callbacks\CallbackManager; | ||||||
| use ManiaControl\Commands\CommandListener; | use ManiaControl\Commands\CommandListener; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Manialinks\IconManager; | use ManiaControl\Manialinks\IconManager; | ||||||
| use ManiaControl\Manialinks\ManialinkPageAnswerListener; | use ManiaControl\Manialinks\ManialinkPageAnswerListener; | ||||||
| @@ -221,7 +222,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
|  |  | ||||||
| 		$message = $player->getEscapedNickname() . ' skipped the current Map!'; | 		$message = $player->getEscapedNickname() . ' skipped the current Map!'; | ||||||
| 		$this->maniaControl->getChat()->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 		$this->maniaControl->log($message, true); | 		Logger::logInfo($message, true, true, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -237,7 +238,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 		} | 		} | ||||||
| 		$message = $player->getEscapedNickname() . ' restarted the current Map!'; | 		$message = $player->getEscapedNickname() . ' restarted the current Map!'; | ||||||
| 		$this->maniaControl->getChat()->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 		$this->maniaControl->log($message, true); | 		Logger::logInfo($message, true, true, true); | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->getClient()->restartMap(); | 			$this->maniaControl->getClient()->restartMap(); | ||||||
| @@ -259,7 +260,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 		} | 		} | ||||||
| 		$message = $player->getEscapedNickname() . ' replays the current Map!'; | 		$message = $player->getEscapedNickname() . ' replays the current Map!'; | ||||||
| 		$this->maniaControl->getChat()->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 		$this->maniaControl->log($message, true); | 		Logger::logInfo($message, true, true, true); | ||||||
|  |  | ||||||
| 		$this->maniaControl->getMapManager()->getMapQueue()->addFirstMapToMapQueue($player, $this->maniaControl->getMapManager()->getCurrentMap()); | 		$this->maniaControl->getMapManager()->getMapQueue()->addFirstMapToMapQueue($player, $this->maniaControl->getMapManager()->getCurrentMap()); | ||||||
| 	} | 	} | ||||||
| @@ -293,7 +294,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
|  |  | ||||||
| 			$message = 'Maplist $<$fff' . $maplist . '$> written.'; | 			$message = 'Maplist $<$fff' . $maplist . '$> written.'; | ||||||
| 			$this->maniaControl->getChat()->sendSuccess($message, $player); | 			$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 			$this->maniaControl->log($message, true); | 			Logger::logInfo($message, true, true, true); | ||||||
| 		} catch (FaultException $e) { | 		} catch (FaultException $e) { | ||||||
| 			$this->maniaControl->getChat()->sendError('Cannot write maplist $<$fff' . $maplist . '$>!', $player); | 			$this->maniaControl->getChat()->sendError('Cannot write maplist $<$fff' . $maplist . '$>!', $player); | ||||||
| 		} | 		} | ||||||
| @@ -329,7 +330,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 			$message = 'Maplist $<$fff' . $maplist . '$> loaded.'; | 			$message = 'Maplist $<$fff' . $maplist . '$> loaded.'; | ||||||
| 			$this->maniaControl->getMapManager()->restructureMapList(); | 			$this->maniaControl->getMapManager()->restructureMapList(); | ||||||
| 			$this->maniaControl->getChat()->sendSuccess($message, $player); | 			$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 			$this->maniaControl->log($message, true); | 			Logger::logInfo($message, true, true, true); | ||||||
| 		} catch (FaultException $e) { | 		} catch (FaultException $e) { | ||||||
| 			$this->maniaControl->getChat()->sendError('Cannot load maplist $<$fff' . $maplist . '$>!', $player); | 			$this->maniaControl->getChat()->sendError('Cannot load maplist $<$fff' . $maplist . '$>!', $player); | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ use FML\Script\Features\Paging; | |||||||
| use ManiaControl\Callbacks\CallbackListener; | use ManiaControl\Callbacks\CallbackListener; | ||||||
| use ManiaControl\Callbacks\CallbackManager; | use ManiaControl\Callbacks\CallbackManager; | ||||||
| use ManiaControl\Callbacks\Callbacks; | use ManiaControl\Callbacks\Callbacks; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Manialinks\IconManager; | use ManiaControl\Manialinks\IconManager; | ||||||
| use ManiaControl\Manialinks\ManialinkManager; | use ManiaControl\Manialinks\ManialinkManager; | ||||||
| @@ -654,7 +655,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
|  |  | ||||||
| 				$message = $player->getEscapedNickname() . ' skipped to Map $z' . $map->getEscapedName() . '!'; | 				$message = $player->getEscapedNickname() . ' skipped to Map $z' . $map->getEscapedName() . '!'; | ||||||
| 				$this->maniaControl->getChat()->sendSuccess($message); | 				$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 				$this->maniaControl->log($message, true); | 				Logger::logInfo($message, true, true, true); | ||||||
|  |  | ||||||
| 				$this->playerCloseWidget($player); | 				$this->playerCloseWidget($player); | ||||||
| 				break; | 				break; | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ use ManiaControl\Callbacks\CallbackListener; | |||||||
| use ManiaControl\Callbacks\CallbackManager; | use ManiaControl\Callbacks\CallbackManager; | ||||||
| use ManiaControl\Callbacks\Callbacks; | use ManiaControl\Callbacks\Callbacks; | ||||||
| use ManiaControl\Files\FileUtil; | use ManiaControl\Files\FileUtil; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\ManiaExchange\ManiaExchangeList; | use ManiaControl\ManiaExchange\ManiaExchangeList; | ||||||
| use ManiaControl\ManiaExchange\ManiaExchangeManager; | use ManiaControl\ManiaExchange\ManiaExchangeManager; | ||||||
| @@ -315,7 +316,7 @@ class MapManager implements CallbackListener { | |||||||
| 			$action  = ($eraseFile ? 'erased' : 'removed'); | 			$action  = ($eraseFile ? 'erased' : 'removed'); | ||||||
| 			$message = $admin->getEscapedNickname() . ' ' . $action . ' ' . $map->getEscapedName() . '!'; | 			$message = $admin->getEscapedNickname() . ' ' . $action . ' ' . $map->getEscapedName() . '!'; | ||||||
| 			$this->maniaControl->getChat()->sendSuccess($message); | 			$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 			$this->maniaControl->log($message, true); | 			Logger::logInfo($message, true, true, true); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -445,13 +446,13 @@ class MapManager implements CallbackListener { | |||||||
| 			// Message | 			// Message | ||||||
| 			$message = $player->getEscapedNickname() . ' added $<' . $mapInfo->name . '$>!'; | 			$message = $player->getEscapedNickname() . ' added $<' . $mapInfo->name . '$>!'; | ||||||
| 			$this->maniaControl->getChat()->sendSuccess($message); | 			$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 			$this->maniaControl->log($message, true); | 			Logger::logInfo($message, true, true, true); | ||||||
| 			// Queue requested Map | 			// Queue requested Map | ||||||
| 			$this->maniaControl->getMapManager()->getMapQueue()->addMapToMapQueue($login, $mapInfo->uid); | 			$this->maniaControl->getMapManager()->getMapQueue()->addMapToMapQueue($login, $mapInfo->uid); | ||||||
| 		} else { | 		} else { | ||||||
| 			$message = $player->getEscapedNickname() . ' updated $<' . $mapInfo->name . '$>!'; | 			$message = $player->getEscapedNickname() . ' updated $<' . $mapInfo->name . '$>!'; | ||||||
| 			$this->maniaControl->getChat()->sendSuccess($message); | 			$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 			$this->maniaControl->log($message, true); | 			Logger::logInfo($message, true, true, true); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -513,7 +514,7 @@ class MapManager implements CallbackListener { | |||||||
| 			try { | 			try { | ||||||
| 				$this->maniaControl->getClient()->saveMatchSettings($matchSettingsFileName); | 				$this->maniaControl->getClient()->saveMatchSettings($matchSettingsFileName); | ||||||
| 			} catch (FileException $e) { | 			} catch (FileException $e) { | ||||||
| 				$this->maniaControl->log("Unable to write the playlist file, please checkout your MX-Folders File permissions!"); | 				Logger::logError("Unable to write the playlist file, please checkout your MX-Folders File permissions!"); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -602,7 +603,7 @@ class MapManager implements CallbackListener { | |||||||
| 		if ($admin) { | 		if ($admin) { | ||||||
| 			$message = $admin->getEscapedNickname() . ' shuffled the Maplist!'; | 			$message = $admin->getEscapedNickname() . ' shuffled the Maplist!'; | ||||||
| 			$this->maniaControl->getChat()->sendSuccess($message); | 			$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 			$this->maniaControl->log($message, true); | 			Logger::logInfo($message, true, true, true); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Restructure if needed | 		// Restructure if needed | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ use ManiaControl\Admin\AuthenticationManager; | |||||||
| use ManiaControl\Callbacks\CallbackListener; | use ManiaControl\Callbacks\CallbackListener; | ||||||
| use ManiaControl\Callbacks\Callbacks; | use ManiaControl\Callbacks\Callbacks; | ||||||
| use ManiaControl\Commands\CommandListener; | use ManiaControl\Commands\CommandListener; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Players\Player; | use ManiaControl\Players\Player; | ||||||
| use ManiaControl\Utils\Formatter; | use ManiaControl\Utils\Formatter; | ||||||
| @@ -122,8 +123,9 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 		//Destroy map - queue list | 		//Destroy map - queue list | ||||||
| 		$this->queuedMaps = array(); | 		$this->queuedMaps = array(); | ||||||
|  |  | ||||||
| 		$this->maniaControl->getChat()->sendInformation('$fa0' . $title . ' $<$fff' . $admin->nickname . '$> cleared the Queued-Map list!'); | 		$message = '$fa0' . $title . ' $<$fff' . $admin->nickname . '$> cleared the Map-Queue!'; | ||||||
| 		$this->maniaControl->log($title . ' ' . Formatter::stripCodes($admin->nickname) . ' cleared the Queued-Map list!'); | 		$this->maniaControl->getChat()->sendInformation($message); | ||||||
|  | 		Logger::logInfo($message, true, true, true); | ||||||
|  |  | ||||||
| 		// Trigger callback | 		// Trigger callback | ||||||
| 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('clear')); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('clear')); | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ use FML\Controls\Quad; | |||||||
| use FML\Controls\Quads\Quad_Icons64x64_1; | use FML\Controls\Quads\Quad_Icons64x64_1; | ||||||
| use FML\ManiaLink; | use FML\ManiaLink; | ||||||
| use ManiaControl\Admin\AuthenticationManager; | use ManiaControl\Admin\AuthenticationManager; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Manialinks\ManialinkManager; | use ManiaControl\Manialinks\ManialinkManager; | ||||||
| use ManiaControl\Utils\Formatter; | use ManiaControl\Utils\Formatter; | ||||||
| @@ -101,8 +102,7 @@ class PlayerActions { | |||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->getClient()->forcePlayerTeam($target->login, $teamId); | 			$this->maniaControl->getClient()->forcePlayerTeam($target->login, $teamId); | ||||||
| 		} catch (FaultException $exception) { | 		} catch (ServerOptionsException $exception) { | ||||||
| 			// TODO: replace by more specific exception "there are too many ..." |  | ||||||
| 			$this->forcePlayerToPlay($adminLogin, $targetLogin); | 			$this->forcePlayerToPlay($adminLogin, $targetLogin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -118,7 +118,7 @@ class PlayerActions { | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		Logger::logInfo($chatMessage, true, true, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -197,7 +197,7 @@ class PlayerActions { | |||||||
| 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' forced ' . $target->getEscapedNickname(). ' to Spectator!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' forced ' . $target->getEscapedNickname(). ' to Spectator!'; | ||||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		Logger::logInfo($chatMessage, true, true, true); | ||||||
|  |  | ||||||
| 		if ($releaseSlot) { | 		if ($releaseSlot) { | ||||||
| 			// Free player slot | 			// Free player slot | ||||||
| @@ -238,7 +238,7 @@ class PlayerActions { | |||||||
| 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' un-muted ' . $target->getEscapedNickname(). '!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' un-muted ' . $target->getEscapedNickname(). '!'; | ||||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		Logger::logInfo($chatMessage, true, true, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -270,7 +270,7 @@ class PlayerActions { | |||||||
| 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' muted ' . $target->getEscapedNickname(). '!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' muted ' . $target->getEscapedNickname(). '!'; | ||||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		Logger::logInfo($chatMessage, true, true, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -352,7 +352,7 @@ class PlayerActions { | |||||||
| 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' warned ' . $target->getEscapedNickname(). '!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' warned ' . $target->getEscapedNickname(). '!'; | ||||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		Logger::log($chatMessage, true, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -388,7 +388,7 @@ class PlayerActions { | |||||||
| 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' kicked ' . $target->getEscapedNickname() . '!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' kicked ' . $target->getEscapedNickname() . '!'; | ||||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log(Formatter::stripCodes($chatMessage)); | 		Logger::logInfo($chatMessage, true, true, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -420,7 +420,7 @@ class PlayerActions { | |||||||
| 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' banned ' . $target->getEscapedNickname(). '!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' banned ' . $target->getEscapedNickname(). '!'; | ||||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		Logger::logInfo($chatMessage, true, true, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -458,7 +458,7 @@ class PlayerActions { | |||||||
| 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' added ' . $target->getEscapedNickname(). ' as $< ' . $authLevelName . '$>!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' added ' . $target->getEscapedNickname(). ' as $< ' . $authLevelName . '$>!'; | ||||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		Logger::logInfo($chatMessage, true, true, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -495,7 +495,7 @@ class PlayerActions { | |||||||
| 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' revoked the Rights of ' . $target->getEscapedNickname(). '!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' revoked the Rights of ' . $target->getEscapedNickname(). '!'; | ||||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		Logger::logInfo($chatMessage, true, true, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ use ManiaControl\Callbacks\CallbackListener; | |||||||
| use ManiaControl\Callbacks\CallbackManager; | use ManiaControl\Callbacks\CallbackManager; | ||||||
| use ManiaControl\Callbacks\Callbacks; | use ManiaControl\Callbacks\Callbacks; | ||||||
| use ManiaControl\Callbacks\TimerListener; | use ManiaControl\Callbacks\TimerListener; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Statistics\StatisticManager; | use ManiaControl\Statistics\StatisticManager; | ||||||
| use ManiaControl\Utils\Formatter; | use ManiaControl\Utils\Formatter; | ||||||
| @@ -318,7 +319,7 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
|  |  | ||||||
| 		$played     = Formatter::formatTimeH(time() - $player->joinTime); | 		$played     = Formatter::formatTimeH(time() - $player->joinTime); | ||||||
| 		$logMessage = "Player left: {$player->login} / {$player->nickname} Playtime: {$played}"; | 		$logMessage = "Player left: {$player->login} / {$player->nickname} Playtime: {$played}"; | ||||||
| 		$this->maniaControl->log(Formatter::stripCodes($logMessage)); | 		Logger::logInfo($logMessage, true, true, true); | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_JOIN_LEAVE_MESSAGES)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_JOIN_LEAVE_MESSAGES)) { | ||||||
| 			$this->maniaControl->getChat()->sendChat('$0f0$<$fff' . $player->nickname . '$> has left the game'); | 			$this->maniaControl->getChat()->sendChat('$0f0$<$fff' . $player->nickname . '$> has left the game'); | ||||||
| @@ -415,8 +416,8 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 				$this->maniaControl->getChat()->sendInformation('This server uses ManiaControl v' . ManiaControl::VERSION . '!', $player->login); | 				$this->maniaControl->getChat()->sendInformation('This server uses ManiaControl v' . ManiaControl::VERSION . '!', $player->login); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$logMessage = "Player joined: {$player->login} / " . Formatter::stripCodes($player->nickname) . " Nation: " . $player->getCountry() . " IP: {$player->ipAddress}"; | 			$logMessage = "Player joined: {$player->login} / {$player->nickname} Nation: " . $player->getCountry() . " IP: {$player->ipAddress}"; | ||||||
| 			$this->maniaControl->log($logMessage); | 			Logger::logInfo($logMessage, true, true, true); | ||||||
|  |  | ||||||
| 			// Increment the Player Join Count | 			// Increment the Player Join Count | ||||||
| 			$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_JOIN_COUNT, $player, $this->maniaControl->getServer()->index); | 			$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_JOIN_COUNT, $player, $this->maniaControl->getServer()->index); | ||||||
|   | |||||||
| @@ -380,7 +380,7 @@ class PluginManager { | |||||||
| 		} catch (\Exception $e) { | 		} catch (\Exception $e) { | ||||||
| 			$message = "Error during Plugin Activation of '{$pluginClass}': '{$e->getMessage()}'"; | 			$message = "Error during Plugin Activation of '{$pluginClass}': '{$e->getMessage()}'"; | ||||||
| 			$this->maniaControl->getChat()->sendError($message, $adminLogin); | 			$this->maniaControl->getChat()->sendError($message, $adminLogin); | ||||||
| 			$this->maniaControl->log($message); | 			Logger::logError($message); | ||||||
| 			$this->savePluginStatus($pluginClass, false); | 			$this->savePluginStatus($pluginClass, false); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -19,6 +19,7 @@ use ManiaControl\Admin\AuthenticationManager; | |||||||
| use ManiaControl\Callbacks\CallbackListener; | use ManiaControl\Callbacks\CallbackListener; | ||||||
| use ManiaControl\Callbacks\CallbackManager; | use ManiaControl\Callbacks\CallbackManager; | ||||||
| use ManiaControl\Configurator\ConfiguratorMenu; | use ManiaControl\Configurator\ConfiguratorMenu; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Manialinks\ManialinkPageAnswerListener; | use ManiaControl\Manialinks\ManialinkPageAnswerListener; | ||||||
| use ManiaControl\Players\Player; | use ManiaControl\Players\Player; | ||||||
| @@ -366,7 +367,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 			$activated = $this->maniaControl->getPluginManager()->activatePlugin($pluginClass, $player->login); | 			$activated = $this->maniaControl->getPluginManager()->activatePlugin($pluginClass, $player->login); | ||||||
| 			if ($activated) { | 			if ($activated) { | ||||||
| 				$this->maniaControl->getChat()->sendSuccess($pluginClass::getName() . ' activated!', $player); | 				$this->maniaControl->getChat()->sendSuccess($pluginClass::getName() . ' activated!', $player); | ||||||
| 				$this->maniaControl->log("{$player->login} activated '{$pluginClass}'!", true); | 				Logger::logInfo("{$player->login} activated '{$pluginClass}'!", true, true, true); | ||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->getChat()->sendError('Error activating ' . $pluginClass::getName() . '!', $player); | 				$this->maniaControl->getChat()->sendError('Error activating ' . $pluginClass::getName() . '!', $player); | ||||||
| 			} | 			} | ||||||
| @@ -376,7 +377,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 			$deactivated = $this->maniaControl->getPluginManager()->deactivatePlugin($pluginClass); | 			$deactivated = $this->maniaControl->getPluginManager()->deactivatePlugin($pluginClass); | ||||||
| 			if ($deactivated) { | 			if ($deactivated) { | ||||||
| 				$this->maniaControl->getChat()->sendSuccess($pluginClass::getName() . ' deactivated!', $player); | 				$this->maniaControl->getChat()->sendSuccess($pluginClass::getName() . ' deactivated!', $player); | ||||||
| 				$this->maniaControl->log("{$player->login} deactivated '{$pluginClass}'!", true); | 				Logger::logInfo("{$player->login} deactivated '{$pluginClass}'!", true, true, true); | ||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->getChat()->sendError('Error deactivating ' . $pluginClass::getName() . '!', $player); | 				$this->maniaControl->getChat()->sendError('Error deactivating ' . $pluginClass::getName() . '!', $player); | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -10,6 +10,7 @@ use ManiaControl\Callbacks\CallbackListener; | |||||||
| use ManiaControl\Callbacks\Callbacks; | use ManiaControl\Callbacks\Callbacks; | ||||||
| use ManiaControl\Callbacks\TimerListener; | use ManiaControl\Callbacks\TimerListener; | ||||||
| use ManiaControl\Commands\CommandListener; | use ManiaControl\Commands\CommandListener; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Manialinks\ManialinkPageAnswerListener; | use ManiaControl\Manialinks\ManialinkPageAnswerListener; | ||||||
| use ManiaControl\Players\Player; | use ManiaControl\Players\Player; | ||||||
| @@ -259,7 +260,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param string $login | 	 * @param string $login | ||||||
| 	 */ | 	 */ | ||||||
| 	private function shutdownServer($login = '-') { | 	private function shutdownServer($login = '-') { | ||||||
| 		$this->maniaControl->log("Server shutdown requested by '{$login}'!"); | 		Logger::logInfo("Server shutdown requested by '{$login}'!"); | ||||||
| 		$this->maniaControl->getClient()->stopServer(); | 		$this->maniaControl->getClient()->stopServer(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ | |||||||
|  |  | ||||||
| namespace ManiaControl\Server; | namespace ManiaControl\Server; | ||||||
|  |  | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -48,7 +49,7 @@ class ScriptManager { | |||||||
| 		$actionName                             = ($enable ? 'en' : 'dis'); | 		$actionName                             = ($enable ? 'en' : 'dis'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->getClient()->setModeScriptSettings($scriptSettings); | 		$this->maniaControl->getClient()->setModeScriptSettings($scriptSettings); | ||||||
| 		$this->maniaControl->log("Script Callbacks successfully {$actionName}abled!"); | 		Logger::logInfo("Script Callbacks successfully {$actionName}abled!"); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ namespace ManiaControl\Server; | |||||||
|  |  | ||||||
| use ManiaControl\Callbacks\CallbackListener; | use ManiaControl\Callbacks\CallbackListener; | ||||||
| use ManiaControl\Callbacks\Callbacks; | use ManiaControl\Callbacks\Callbacks; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Players\Player; | use ManiaControl\Players\Player; | ||||||
| use ManiaControl\Utils\CommandLineHelper; | use ManiaControl\Utils\CommandLineHelper; | ||||||
| @@ -399,18 +400,18 @@ class Server implements CallbackListener { | |||||||
| 		$waitBegin   = time(); | 		$waitBegin   = time(); | ||||||
| 		$maxWaitTime = 50; | 		$maxWaitTime = 50; | ||||||
| 		$lastStatus  = $response->name; | 		$lastStatus  = $response->name; | ||||||
| 		$this->maniaControl->log("Waiting for server to reach status {$statusCode}..."); | 		Logger::log("Waiting for server to reach status {$statusCode}..."); | ||||||
| 		$this->maniaControl->log("Current Status: {$lastStatus}"); | 		Logger::log("Current Status: {$lastStatus}"); | ||||||
| 		while ($response->code !== 4) { | 		while ($response->code !== 4) { | ||||||
| 			sleep(1); | 			sleep(1); | ||||||
| 			$response = $this->maniaControl->getClient()->getStatus(); | 			$response = $this->maniaControl->getClient()->getStatus(); | ||||||
| 			if ($lastStatus !== $response->name) { | 			if ($lastStatus !== $response->name) { | ||||||
| 				$this->maniaControl->log("New Status: {$response->name}"); | 				Logger::log("New Status: {$response->name}"); | ||||||
| 				$lastStatus = $response->name; | 				$lastStatus = $response->name; | ||||||
| 			} | 			} | ||||||
| 			if (time() - $maxWaitTime > $waitBegin) { | 			if (time() - $maxWaitTime > $waitBegin) { | ||||||
| 				// It took too long to reach the status | 				// It took too long to reach the status | ||||||
| 				trigger_error("Server couldn't reach status {$statusCode} after {$maxWaitTime} seconds! "); | 				Logger::logError("Server couldn't reach status {$statusCode} after {$maxWaitTime} seconds! "); | ||||||
| 				return false; | 				return false; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ | |||||||
| namespace ManiaControl\Server; | namespace ManiaControl\Server; | ||||||
|  |  | ||||||
| use ManiaControl\Callbacks\TimerListener; | use ManiaControl\Callbacks\TimerListener; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Utils\Formatter; | use ManiaControl\Utils\Formatter; | ||||||
| use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; | use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; | ||||||
| @@ -80,7 +81,7 @@ class UsageReporter implements TimerListener { | |||||||
| 		$this->maniaControl->getFileReader()->loadFile($url, function ($response, $error) { | 		$this->maniaControl->getFileReader()->loadFile($url, function ($response, $error) { | ||||||
| 			$response = json_decode($response); | 			$response = json_decode($response); | ||||||
| 			if ($error || !$response) { | 			if ($error || !$response) { | ||||||
| 				$this->maniaControl->log('Error while Sending data: ' . print_r($error, true)); | 				Logger::logError('Error while Sending data: ' . print_r($error, true)); | ||||||
| 			} | 			} | ||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -72,7 +72,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 		if ($player) { | 		if ($player) { | ||||||
| 			$this->maniaControl->getChat()->sendInformation($message, $player); | 			$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->log($message); | 		Logger::log($message); | ||||||
|  |  | ||||||
| 		$this->maniaControl->getPluginManager()->fetchPluginList(function ($data, $error) use (&$player) { | 		$this->maniaControl->getPluginManager()->fetchPluginList(function ($data, $error) use (&$player) { | ||||||
| 			if (!$data || $error) { | 			if (!$data || $error) { | ||||||
| @@ -80,7 +80,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->getChat()->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				Logger::logError($message); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| @@ -103,7 +103,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 					if ($player) { | 					if ($player) { | ||||||
| 						$this->maniaControl->getChat()->sendSuccess($message, $player); | 						$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 					} | 					} | ||||||
| 					$this->maniaControl->log($message); | 					Logger::log($message); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| @@ -112,14 +112,14 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->getChat()->sendSuccess($message, $player); | 					$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				Logger::log($message); | ||||||
| 			} else { | 			} else { | ||||||
| 				$updatesCount = count($pluginUpdates); | 				$updatesCount = count($pluginUpdates); | ||||||
| 				$message      = "Plugins Update Check completed: There are {$updatesCount} Updates available!"; | 				$message      = "Plugins Update Check completed: There are {$updatesCount} Updates available!"; | ||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->getChat()->sendSuccess($message, $player); | 					$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				Logger::log($message); | ||||||
| 			} | 			} | ||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
| @@ -169,7 +169,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->getChat()->sendInformation($message, $player); | 				$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			Logger::log($message); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -177,7 +177,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 		if ($player) { | 		if ($player) { | ||||||
| 			$this->maniaControl->getChat()->sendInformation($message, $player); | 			$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->log($message); | 		Logger::log($message); | ||||||
|  |  | ||||||
| 		$performBackup = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getUpdateManager(), UpdateManager::SETTING_PERFORM_BACKUPS); | 		$performBackup = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getUpdateManager(), UpdateManager::SETTING_PERFORM_BACKUPS); | ||||||
| 		if ($performBackup && !BackupUtil::performPluginsBackup()) { | 		if ($performBackup && !BackupUtil::performPluginsBackup()) { | ||||||
| @@ -185,7 +185,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->getChat()->sendError($message, $player); | 				$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			Logger::logError($message); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		foreach ($pluginsUpdates as $pluginUpdateData) { | 		foreach ($pluginsUpdates as $pluginUpdateData) { | ||||||
| @@ -246,7 +246,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->getChat()->sendInformation($message, $player); | 					$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				Logger::logError($message); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| @@ -258,7 +258,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->getChat()->sendInformation($message, $player); | 				$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			Logger::log($message); | ||||||
|  |  | ||||||
| 			$tempDir        = FileUtil::getTempFolder(); | 			$tempDir        = FileUtil::getTempFolder(); | ||||||
| 			$updateFileName = $tempDir . $pluginUpdateData->zipfile; | 			$updateFileName = $tempDir . $pluginUpdateData->zipfile; | ||||||
| @@ -297,7 +297,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->getChat()->sendSuccess($message, $player); | 				$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			Logger::log($message); | ||||||
|  |  | ||||||
| 			if (!$update) { | 			if (!$update) { | ||||||
| 				$newPluginClasses = $this->maniaControl->getPluginManager()->loadPlugins(); | 				$newPluginClasses = $this->maniaControl->getPluginManager()->loadPlugins(); | ||||||
| @@ -306,13 +306,13 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 					if ($player) { | 					if ($player) { | ||||||
| 						$this->maniaControl->getChat()->sendError($message, $player); | 						$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 					} | 					} | ||||||
| 					$this->maniaControl->log($message); | 					Logger::log($message); | ||||||
| 				} else { | 				} else { | ||||||
| 					$message = "Successfully loaded fresh installed Plugin '{$pluginUpdateData->pluginName}'!"; | 					$message = "Successfully loaded fresh installed Plugin '{$pluginUpdateData->pluginName}'!"; | ||||||
| 					if ($player) { | 					if ($player) { | ||||||
| 						$this->maniaControl->getChat()->sendSuccess($message, $player); | 						$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 					} | 					} | ||||||
| 					$this->maniaControl->log($message); | 					Logger::log($message); | ||||||
|  |  | ||||||
| 					$this->maniaControl->getConfigurator()->showMenu($player, InstallMenu::getTitle()); | 					$this->maniaControl->getConfigurator()->showMenu($player, InstallMenu::getTitle()); | ||||||
| 				} | 				} | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ use ManiaControl\Callbacks\TimerListener; | |||||||
| use ManiaControl\Commands\CommandListener; | use ManiaControl\Commands\CommandListener; | ||||||
| use ManiaControl\Files\BackupUtil; | use ManiaControl\Files\BackupUtil; | ||||||
| use ManiaControl\Files\FileUtil; | use ManiaControl\Files\FileUtil; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Players\Player; | use ManiaControl\Players\Player; | ||||||
| use ManiaControl\Players\PlayerManager; | use ManiaControl\Players\PlayerManager; | ||||||
| @@ -141,7 +142,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
|  |  | ||||||
| 		$this->maniaControl->getFileReader()->loadFile($url, function ($dataJson, $error) use (&$function) { | 		$this->maniaControl->getFileReader()->loadFile($url, function ($dataJson, $error) use (&$function) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log('Error on UpdateCheck: ' . $error); | 				Logger::logError('Error on UpdateCheck: ' . $error); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			$versions = json_decode($dataJson); | 			$versions = json_decode($dataJson); | ||||||
| @@ -180,15 +181,15 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 		} | 		} | ||||||
| 		if (!$this->checkUpdateDataBuildVersion($updateData)) { | 		if (!$this->checkUpdateDataBuildVersion($updateData)) { | ||||||
| 			// Server incompatible | 			// Server incompatible | ||||||
| 			$this->maniaControl->log("Please update Your Server to '{$updateData->minDedicatedBuild}' in order to receive further Updates!"); | 			Logger::logError("Please update Your Server to '{$updateData->minDedicatedBuild}' in order to receive further Updates!"); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->coreUpdateData != $updateData) { | 		if ($this->coreUpdateData != $updateData) { | ||||||
| 			if ($this->isNightlyUpdateChannel()) { | 			if ($this->isNightlyUpdateChannel()) { | ||||||
| 				$this->maniaControl->log("New Nightly Build ({$updateData->releaseDate}) available!"); | 				Logger::log("New Nightly Build ({$updateData->releaseDate}) available!"); | ||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->log("New ManiaControl Version {$updateData->version} available!"); | 				Logger::log("New ManiaControl Version {$updateData->version} available!"); | ||||||
| 			} | 			} | ||||||
| 			$this->setCoreUpdateData($updateData); | 			$this->setCoreUpdateData($updateData); | ||||||
| 		} | 		} | ||||||
| @@ -300,11 +301,11 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->getChat()->sendError($message, $player); | 				$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			Logger::logError($message); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->log("Starting Update to Version v{$this->coreUpdateData->version}..."); | 		Logger::log("Starting Update to Version v{$this->coreUpdateData->version}..."); | ||||||
|  |  | ||||||
| 		$directories = array('core', 'plugins'); | 		$directories = array('core', 'plugins'); | ||||||
| 		if (!FileUtil::checkWritePermissions($directories)) { | 		if (!FileUtil::checkWritePermissions($directories)) { | ||||||
| @@ -312,7 +313,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->getChat()->sendError($message, $player); | 				$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			Logger::logError($message); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -322,7 +323,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->getChat()->sendError($message, $player); | 				$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			Logger::logError($message); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$updateData = $this->coreUpdateData; | 		$updateData = $this->coreUpdateData; | ||||||
| @@ -334,7 +335,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->getChat()->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				Logger::logError($message); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| @@ -344,7 +345,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->getChat()->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				Logger::logError($message); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			$updateFileName = $tempDir . basename($updateData->url); | 			$updateFileName = $tempDir . basename($updateData->url); | ||||||
| @@ -355,7 +356,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->getChat()->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				Logger::logError($message); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| @@ -366,7 +367,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->getChat()->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				Logger::logError($message); | ||||||
| 				unlink($updateFileName); | 				unlink($updateFileName); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| @@ -383,7 +384,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->getChat()->sendSuccess($message, $player); | 				$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			Logger::log($message); | ||||||
|  |  | ||||||
| 			$this->maniaControl->restart(); | 			$this->maniaControl->restart(); | ||||||
| 		}); | 		}); | ||||||
|   | |||||||
| @@ -196,10 +196,10 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
|  |  | ||||||
| 		//$this->maniaControl->fileReader->postDataTest($this->request, self::DEDIMANIA_URL, function ($data, $error) { | 		//$this->maniaControl->fileReader->postDataTest($this->request, self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			$this->maniaControl->log("Try to connect on Dedimania"); | 			Logger::log("Try to connect on Dedimania"); | ||||||
|  |  | ||||||
| 			if (!$data || $error) { | 			if (!$data || $error) { | ||||||
| 				$this->maniaControl->log("Dedimania Error: '{$error}'"); | 				Logger::logError("Dedimania Error: '{$error}'"); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$data = $this->decode($data); | 			$data = $this->decode($data); | ||||||
| @@ -216,11 +216,11 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 			$responseData                   = $methodResponse[0]; | 			$responseData                   = $methodResponse[0]; | ||||||
| 			$this->dedimaniaData->sessionId = $responseData['SessionId']; | 			$this->dedimaniaData->sessionId = $responseData['SessionId']; | ||||||
| 			if ($this->dedimaniaData->sessionId) { | 			if ($this->dedimaniaData->sessionId) { | ||||||
| 				$this->maniaControl->log("Dedimania connection successfully established."); | 				Logger::log("Dedimania connection successfully established."); | ||||||
| 				$this->fetchDedimaniaRecords(); | 				$this->fetchDedimaniaRecords(); | ||||||
| 				$this->init = true; | 				$this->init = true; | ||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->log("Error while opening Dedimania Connection"); | 				Logger::logError("Error while opening Dedimania Connection"); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if (self::DEDIMANIA_DEBUG) { | 			if (self::DEDIMANIA_DEBUG) { | ||||||
| @@ -296,7 +296,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		//$this->maniaControl->fileReader->postDataTest($this->request,self::DEDIMANIA_URL, function ($data, $error) { | 		//$this->maniaControl->fileReader->postDataTest($this->request,self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log('Dedimania Error: ' . $error); | 				Logger::logError('Dedimania Error: ' . $error); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$data = $this->decode($data); | 			$data = $this->decode($data); | ||||||
| @@ -572,7 +572,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		//$this->maniaControl->fileReader->postDataTest($this->request, self::DEDIMANIA_URL, function ($data, $error) { | 		//$this->maniaControl->fileReader->postDataTest($this->request, self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | 				Logger::logError("Dedimania Error: " . $error); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$data = $this->decode($data); | 			$data = $this->decode($data); | ||||||
| @@ -616,7 +616,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
|  |  | ||||||
| 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$player) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$player) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | 				Logger::logError("Dedimania Error: " . $error); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$data = $this->decode($data); | 			$data = $this->decode($data); | ||||||
| @@ -663,7 +663,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
|  |  | ||||||
| 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | 				Logger::logError("Dedimania Error: " . $error); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$data = $this->decode($data); | 			$data = $this->decode($data); | ||||||
| @@ -733,7 +733,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
|  |  | ||||||
| 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | 				Logger::logError("Dedimania Error: " . $error); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if (self::DEDIMANIA_DEBUG) { | 			if (self::DEDIMANIA_DEBUG) { | ||||||
| @@ -783,7 +783,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
|  |  | ||||||
| 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | 				Logger::logError("Dedimania Error: " . $error); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$data = $this->decode($data); | 			$data = $this->decode($data); | ||||||
|   | |||||||
| @@ -12,6 +12,7 @@ use ManiaControl\Callbacks\CallbackManager; | |||||||
| use ManiaControl\Callbacks\Callbacks; | use ManiaControl\Callbacks\Callbacks; | ||||||
| use ManiaControl\Callbacks\TimerListener; | use ManiaControl\Callbacks\TimerListener; | ||||||
| use ManiaControl\Files\AsynchronousFileReader; | use ManiaControl\Files\AsynchronousFileReader; | ||||||
|  | use ManiaControl\Logger; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Maps\Map; | use ManiaControl\Maps\Map; | ||||||
| use ManiaControl\Players\Player; | use ManiaControl\Players\Player; | ||||||
| @@ -265,7 +266,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 				$this->mxKarma['session'] = $data->data; | 				$this->mxKarma['session'] = $data->data; | ||||||
| 				$this->activateSession($mxKarmaCode); | 				$this->activateSession($mxKarmaCode); | ||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->log("Error while authenticating on Mania-Exchange Karma"); | 				Logger::logError("Error while authenticating on Mania-Exchange Karma"); | ||||||
| 				// TODO remove temp trigger | 				// TODO remove temp trigger | ||||||
| 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('auth error', $data->data->message); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('auth error', $data->data->message); | ||||||
| 				$this->mxKarma['connectionInProgress'] = false; | 				$this->mxKarma['connectionInProgress'] = false; | ||||||
| @@ -297,7 +298,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			if ($data->success && $data->data->activated) { | 			if ($data->success && $data->data->activated) { | ||||||
| 				$this->maniaControl->log('Successfully authenticated on Mania-Exchange Karma'); | 				Logger::log('Successfully authenticated on Mania-Exchange Karma'); | ||||||
|  |  | ||||||
| 				// Fetch the Mx Karma Votes | 				// Fetch the Mx Karma Votes | ||||||
| 				$this->getMxKarmaVotes(); | 				$this->getMxKarmaVotes(); | ||||||
| @@ -308,7 +309,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 				} else { | 				} else { | ||||||
| 					$this->maniaControl->getErrorHandler()->triggerDebugNotice('auth error', $data->data->message, $query); | 					$this->maniaControl->getErrorHandler()->triggerDebugNotice('auth error', $data->data->message, $query); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log("Error while activating Mania-Exchange Karma Session: " . $data->data->message); | 				Logger::logError("Error while activating Mania-Exchange Karma Session: " . $data->data->message); | ||||||
| 				unset($this->mxKarma['session']); | 				unset($this->mxKarma['session']); | ||||||
| 			} | 			} | ||||||
| 		}, AsynchronousFileReader::CONTENT_TYPE_JSON, 1000); | 		}, AsynchronousFileReader::CONTENT_TYPE_JSON, 1000); | ||||||
| @@ -397,10 +398,10 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
|  |  | ||||||
| 				$this->updateManialink = true; | 				$this->updateManialink = true; | ||||||
| 				$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_KARMA_MXUPDATED, $this->mxKarma); | 				$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_KARMA_MXUPDATED, $this->mxKarma); | ||||||
| 				$this->maniaControl->log('MX-Karma Votes successfully fetched!'); | 				Logger::logInfo('MX-Karma Votes successfully fetched!'); | ||||||
| 			} else { | 			} else { | ||||||
| 				// Problem occurred | 				// Problem occurred | ||||||
| 				$this->maniaControl->log('Error while fetching votes: ' . $data->data->message); | 				Logger::logError('Error while fetching votes: ' . $data->data->message); | ||||||
| 				if ($data->data->message === 'invalid session') { | 				if ($data->data->message === 'invalid session') { | ||||||
| 					unset($this->mxKarma['session']); | 					unset($this->mxKarma['session']); | ||||||
| 				} else { | 				} else { | ||||||
| @@ -496,10 +497,10 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			if ($data->success) { | 			if ($data->success) { | ||||||
| 				$this->maniaControl->log('Votes successfully submitted!'); | 				Logger::logInfo('Votes successfully submitted!'); | ||||||
| 			} else { | 			} else { | ||||||
| 				// Problem occurred | 				// Problem occurred | ||||||
| 				$this->maniaControl->log("Error while updating votes: '{$data->data->message}'"); | 				Logger::logError("Error while updating votes: '{$data->data->message}'"); | ||||||
| 				if ($data->data->message === "invalid session") { | 				if ($data->data->message === "invalid session") { | ||||||
| 					unset($this->mxKarma['session']); | 					unset($this->mxKarma['session']); | ||||||
| 				} else { | 				} else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user