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\Callbacks; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Players\Player; | ||||
| use ManiaControl\Players\PlayerManager; | ||||
| @@ -147,7 +148,7 @@ class AuthenticationManager implements CallbackListener { | ||||
| 	private function updateMasterAdmins() { | ||||
| 		$masterAdminsElements = $this->maniaControl->getConfig()->xpath('masteradmins'); | ||||
| 		if (!$masterAdminsElements) { | ||||
| 			$this->maniaControl->log('Missing MasterAdmins configuration!', true); | ||||
| 			Logger::logError('Missing MasterAdmins configuration!'); | ||||
| 			return false; | ||||
| 		} | ||||
| 		$masterAdminsElement = $masterAdminsElements[0]; | ||||
|   | ||||
| @@ -14,6 +14,7 @@ use FML\Script\Script; | ||||
| use ManiaControl\Admin\AuthenticationManager; | ||||
| use ManiaControl\Callbacks\CallbackListener; | ||||
| use ManiaControl\Callbacks\Callbacks; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Players\Player; | ||||
| use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; | ||||
| @@ -389,7 +390,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | ||||
|  | ||||
| 		$chatMessage .= '!'; | ||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||
| 		$this->maniaControl->log($chatMessage, true); | ||||
| 		Logger::logInfo($chatMessage, true, true, true); | ||||
| 		return true; | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -128,7 +128,7 @@ class Database implements TimerListener { | ||||
| 		if ($result) { | ||||
| 			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 | ||||
| 		$databaseQuery = "CREATE DATABASE " . $this->getMysqli()->escape_string($this->config->name) . ";"; | ||||
|   | ||||
| @@ -109,7 +109,7 @@ class ErrorHandler { | ||||
| 		if (!$isUserError && $traceString) { | ||||
| 			$logMessage .= PHP_EOL . 'Trace: ' . PHP_EOL . $traceString; | ||||
| 		} | ||||
| 		$this->maniaControl->log($logMessage); | ||||
| 		Logger::log($logMessage); | ||||
|  | ||||
| 		if (!DEV_MODE && !$isUserError && !$suppressed) { | ||||
| 			// Report error | ||||
| @@ -434,7 +434,7 @@ class ErrorHandler { | ||||
| 		$traceString    = $this->parseBackTrace($exception->getTrace(), $sourceClass); | ||||
|  | ||||
| 		$logMessage = $message . PHP_EOL . 'Class: ' . $exceptionClass . PHP_EOL . 'Trace:' . PHP_EOL . $traceString; | ||||
| 		$this->maniaControl->log($logMessage); | ||||
| 		Logger::log($logMessage); | ||||
|  | ||||
| 		if (!DEV_MODE) { | ||||
| 			$report                    = array(); | ||||
|   | ||||
| @@ -131,7 +131,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | ||||
| 	 * Construct a new ManiaControl instance | ||||
| 	 */ | ||||
| 	public function __construct() { | ||||
| 		$this->log('Loading ManiaControl v' . self::VERSION . ' ...'); | ||||
| 		Logger::log('Loading ManiaControl v' . self::VERSION . ' ...'); | ||||
|  | ||||
| 		$this->errorHandler = new ErrorHandler($this); | ||||
|  | ||||
| @@ -446,10 +446,10 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | ||||
|  | ||||
| 		// Announce restart | ||||
| 		if ($message) { | ||||
| 			$this->log($message); | ||||
| 			Logger::log($message); | ||||
| 		} | ||||
| 		$this->getChat()->sendInformation('Restarting ManiaControl...'); | ||||
| 		$this->log('Restarting ManiaControl!'); | ||||
| 		Logger::log('Restarting ManiaControl!'); | ||||
|  | ||||
| 		// Hide widgets | ||||
| 		if ($this->getClient()) { | ||||
| @@ -490,7 +490,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | ||||
| 	 * Run ManiaControl | ||||
| 	 */ | ||||
| 	public function run() { | ||||
| 		$this->log('Starting ManiaControl v' . self::VERSION . '!'); | ||||
| 		Logger::log('Starting ManiaControl v' . self::VERSION . '!'); | ||||
|  | ||||
| 		// Connect to server | ||||
| 		try { | ||||
| @@ -519,8 +519,8 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | ||||
| 		$this->getCallbackManager()->triggerCallback(Callbacks::AFTERINIT); | ||||
|  | ||||
| 		// Loading finished | ||||
| 		$this->log('Loading completed!'); | ||||
| 		$this->log('Link: '.$this->getServer()->getJoinLink()); | ||||
| 		Logger::log('Loading completed!'); | ||||
| 		Logger::log('Link: '.$this->getServer()->getJoinLink()); | ||||
| 		$this->getChat()->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!'); | ||||
|  | ||||
| 		// Main loop | ||||
| @@ -539,7 +539,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | ||||
| 		// Load remote client | ||||
| 		$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 { | ||||
| 			$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 | ||||
| 		$this->log('Server Connection successfully established!'); | ||||
| 		Logger::log('Server Connection successfully established!'); | ||||
|  | ||||
| 		// Hide old widgets | ||||
| 		$this->getClient()->sendHideManialinkPage(); | ||||
| @@ -582,7 +582,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | ||||
| 		try { | ||||
| 			$this->getCallbackManager()->manageCallbacks(); | ||||
| 		} catch (TransportException $e) { | ||||
| 			$this->log('Connection interrupted!'); | ||||
| 			Logger::logError('Connection interrupted!'); | ||||
| 			$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\ManiaLink; | ||||
| use FML\Script\Features\Paging; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Manialinks\ManialinkManager; | ||||
| use ManiaControl\Manialinks\ManialinkPageAnswerListener; | ||||
| @@ -399,7 +400,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { | ||||
| 		// Message | ||||
| 		$message = $player->getEscapedNickname() . ' added ' . $map->getEscapedName() . '!'; | ||||
| 		$this->maniaControl->getChat()->sendSuccess($message); | ||||
| 		$this->maniaControl->log($message, true); | ||||
| 		Logger::logInfo($message, true, true, true); | ||||
|  | ||||
| 		// Queue requested Map | ||||
| 		$this->maniaControl->getMapManager()->getMapQueue()->addMapToMapQueue($player, $map); | ||||
|   | ||||
| @@ -9,6 +9,7 @@ use ManiaControl\Admin\AuthenticationManager; | ||||
| use ManiaControl\Callbacks\CallbackListener; | ||||
| use ManiaControl\Callbacks\CallbackManager; | ||||
| use ManiaControl\Commands\CommandListener; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Manialinks\IconManager; | ||||
| use ManiaControl\Manialinks\ManialinkPageAnswerListener; | ||||
| @@ -221,7 +222,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | ||||
|  | ||||
| 		$message = $player->getEscapedNickname() . ' skipped the current Map!'; | ||||
| 		$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!'; | ||||
| 		$this->maniaControl->getChat()->sendSuccess($message); | ||||
| 		$this->maniaControl->log($message, true); | ||||
| 		Logger::logInfo($message, true, true, true); | ||||
|  | ||||
| 		try { | ||||
| 			$this->maniaControl->getClient()->restartMap(); | ||||
| @@ -259,7 +260,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | ||||
| 		} | ||||
| 		$message = $player->getEscapedNickname() . ' replays the current Map!'; | ||||
| 		$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()); | ||||
| 	} | ||||
| @@ -293,7 +294,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | ||||
|  | ||||
| 			$message = 'Maplist $<$fff' . $maplist . '$> written.'; | ||||
| 			$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||
| 			$this->maniaControl->log($message, true); | ||||
| 			Logger::logInfo($message, true, true, true); | ||||
| 		} catch (FaultException $e) { | ||||
| 			$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.'; | ||||
| 			$this->maniaControl->getMapManager()->restructureMapList(); | ||||
| 			$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||
| 			$this->maniaControl->log($message, true); | ||||
| 			Logger::logInfo($message, true, true, true); | ||||
| 		} catch (FaultException $e) { | ||||
| 			$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\CallbackManager; | ||||
| use ManiaControl\Callbacks\Callbacks; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Manialinks\IconManager; | ||||
| use ManiaControl\Manialinks\ManialinkManager; | ||||
| @@ -654,7 +655,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | ||||
|  | ||||
| 				$message = $player->getEscapedNickname() . ' skipped to Map $z' . $map->getEscapedName() . '!'; | ||||
| 				$this->maniaControl->getChat()->sendSuccess($message); | ||||
| 				$this->maniaControl->log($message, true); | ||||
| 				Logger::logInfo($message, true, true, true); | ||||
|  | ||||
| 				$this->playerCloseWidget($player); | ||||
| 				break; | ||||
|   | ||||
| @@ -7,6 +7,7 @@ use ManiaControl\Callbacks\CallbackListener; | ||||
| use ManiaControl\Callbacks\CallbackManager; | ||||
| use ManiaControl\Callbacks\Callbacks; | ||||
| use ManiaControl\Files\FileUtil; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\ManiaExchange\ManiaExchangeList; | ||||
| use ManiaControl\ManiaExchange\ManiaExchangeManager; | ||||
| @@ -315,7 +316,7 @@ class MapManager implements CallbackListener { | ||||
| 			$action  = ($eraseFile ? 'erased' : 'removed'); | ||||
| 			$message = $admin->getEscapedNickname() . ' ' . $action . ' ' . $map->getEscapedName() . '!'; | ||||
| 			$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 = $player->getEscapedNickname() . ' added $<' . $mapInfo->name . '$>!'; | ||||
| 			$this->maniaControl->getChat()->sendSuccess($message); | ||||
| 			$this->maniaControl->log($message, true); | ||||
| 			Logger::logInfo($message, true, true, true); | ||||
| 			// Queue requested Map | ||||
| 			$this->maniaControl->getMapManager()->getMapQueue()->addMapToMapQueue($login, $mapInfo->uid); | ||||
| 		} else { | ||||
| 			$message = $player->getEscapedNickname() . ' updated $<' . $mapInfo->name . '$>!'; | ||||
| 			$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 { | ||||
| 				$this->maniaControl->getClient()->saveMatchSettings($matchSettingsFileName); | ||||
| 			} 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) { | ||||
| 			$message = $admin->getEscapedNickname() . ' shuffled the Maplist!'; | ||||
| 			$this->maniaControl->getChat()->sendSuccess($message); | ||||
| 			$this->maniaControl->log($message, true); | ||||
| 			Logger::logInfo($message, true, true, true); | ||||
| 		} | ||||
|  | ||||
| 		// Restructure if needed | ||||
|   | ||||
| @@ -6,6 +6,7 @@ use ManiaControl\Admin\AuthenticationManager; | ||||
| use ManiaControl\Callbacks\CallbackListener; | ||||
| use ManiaControl\Callbacks\Callbacks; | ||||
| use ManiaControl\Commands\CommandListener; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Players\Player; | ||||
| use ManiaControl\Utils\Formatter; | ||||
| @@ -122,8 +123,9 @@ class MapQueue implements CallbackListener, CommandListener { | ||||
| 		//Destroy map - queue list | ||||
| 		$this->queuedMaps = array(); | ||||
|  | ||||
| 		$this->maniaControl->getChat()->sendInformation('$fa0' . $title . ' $<$fff' . $admin->nickname . '$> cleared the Queued-Map list!'); | ||||
| 		$this->maniaControl->log($title . ' ' . Formatter::stripCodes($admin->nickname) . ' cleared the Queued-Map list!'); | ||||
| 		$message = '$fa0' . $title . ' $<$fff' . $admin->nickname . '$> cleared the Map-Queue!'; | ||||
| 		$this->maniaControl->getChat()->sendInformation($message); | ||||
| 		Logger::logInfo($message, true, true, true); | ||||
|  | ||||
| 		// Trigger callback | ||||
| 		$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\ManiaLink; | ||||
| use ManiaControl\Admin\AuthenticationManager; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Manialinks\ManialinkManager; | ||||
| use ManiaControl\Utils\Formatter; | ||||
| @@ -101,8 +102,7 @@ class PlayerActions { | ||||
|  | ||||
| 		try { | ||||
| 			$this->maniaControl->getClient()->forcePlayerTeam($target->login, $teamId); | ||||
| 		} catch (FaultException $exception) { | ||||
| 			// TODO: replace by more specific exception "there are too many ..." | ||||
| 		} catch (ServerOptionsException $exception) { | ||||
| 			$this->forcePlayerToPlay($adminLogin, $targetLogin); | ||||
| 			return; | ||||
| 		} | ||||
| @@ -118,7 +118,7 @@ class PlayerActions { | ||||
| 			return; | ||||
| 		} | ||||
| 		$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); | ||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' forced ' . $target->getEscapedNickname(). ' to Spectator!'; | ||||
| 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||
| 		$this->maniaControl->log($chatMessage, true); | ||||
| 		Logger::logInfo($chatMessage, true, true, true); | ||||
|  | ||||
| 		if ($releaseSlot) { | ||||
| 			// Free player slot | ||||
| @@ -238,7 +238,7 @@ class PlayerActions { | ||||
| 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' un-muted ' . $target->getEscapedNickname(). '!'; | ||||
| 		$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); | ||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' muted ' . $target->getEscapedNickname(). '!'; | ||||
| 		$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); | ||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' warned ' . $target->getEscapedNickname(). '!'; | ||||
| 		$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); | ||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' kicked ' . $target->getEscapedNickname() . '!'; | ||||
| 		$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); | ||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' banned ' . $target->getEscapedNickname(). '!'; | ||||
| 		$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); | ||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' added ' . $target->getEscapedNickname(). ' as $< ' . $authLevelName . '$>!'; | ||||
| 		$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); | ||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' revoked the Rights of ' . $target->getEscapedNickname(). '!'; | ||||
| 		$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\Callbacks; | ||||
| use ManiaControl\Callbacks\TimerListener; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Statistics\StatisticManager; | ||||
| use ManiaControl\Utils\Formatter; | ||||
| @@ -318,7 +319,7 @@ class PlayerManager implements CallbackListener, TimerListener { | ||||
|  | ||||
| 		$played     = Formatter::formatTimeH(time() - $player->joinTime); | ||||
| 		$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)) { | ||||
| 			$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); | ||||
| 			} | ||||
|  | ||||
| 			$logMessage = "Player joined: {$player->login} / " . Formatter::stripCodes($player->nickname) . " Nation: " . $player->getCountry() . " IP: {$player->ipAddress}"; | ||||
| 			$this->maniaControl->log($logMessage); | ||||
| 			$logMessage = "Player joined: {$player->login} / {$player->nickname} Nation: " . $player->getCountry() . " IP: {$player->ipAddress}"; | ||||
| 			Logger::logInfo($logMessage, true, true, true); | ||||
|  | ||||
| 			// Increment the Player Join Count | ||||
| 			$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_JOIN_COUNT, $player, $this->maniaControl->getServer()->index); | ||||
|   | ||||
| @@ -380,7 +380,7 @@ class PluginManager { | ||||
| 		} catch (\Exception $e) { | ||||
| 			$message = "Error during Plugin Activation of '{$pluginClass}': '{$e->getMessage()}'"; | ||||
| 			$this->maniaControl->getChat()->sendError($message, $adminLogin); | ||||
| 			$this->maniaControl->log($message); | ||||
| 			Logger::logError($message); | ||||
| 			$this->savePluginStatus($pluginClass, false); | ||||
| 			return false; | ||||
| 		} | ||||
|   | ||||
| @@ -19,6 +19,7 @@ use ManiaControl\Admin\AuthenticationManager; | ||||
| use ManiaControl\Callbacks\CallbackListener; | ||||
| use ManiaControl\Callbacks\CallbackManager; | ||||
| use ManiaControl\Configurator\ConfiguratorMenu; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Manialinks\ManialinkPageAnswerListener; | ||||
| use ManiaControl\Players\Player; | ||||
| @@ -366,7 +367,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | ||||
| 			$activated = $this->maniaControl->getPluginManager()->activatePlugin($pluginClass, $player->login); | ||||
| 			if ($activated) { | ||||
| 				$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 { | ||||
| 				$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); | ||||
| 			if ($deactivated) { | ||||
| 				$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 { | ||||
| 				$this->maniaControl->getChat()->sendError('Error deactivating ' . $pluginClass::getName() . '!', $player); | ||||
| 			} | ||||
|   | ||||
| @@ -10,6 +10,7 @@ use ManiaControl\Callbacks\CallbackListener; | ||||
| use ManiaControl\Callbacks\Callbacks; | ||||
| use ManiaControl\Callbacks\TimerListener; | ||||
| use ManiaControl\Commands\CommandListener; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Manialinks\ManialinkPageAnswerListener; | ||||
| use ManiaControl\Players\Player; | ||||
| @@ -259,7 +260,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | ||||
| 	 * @param string $login | ||||
| 	 */ | ||||
| 	private function shutdownServer($login = '-') { | ||||
| 		$this->maniaControl->log("Server shutdown requested by '{$login}'!"); | ||||
| 		Logger::logInfo("Server shutdown requested by '{$login}'!"); | ||||
| 		$this->maniaControl->getClient()->stopServer(); | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
|  | ||||
| namespace ManiaControl\Server; | ||||
|  | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
|  | ||||
| /** | ||||
| @@ -48,7 +49,7 @@ class ScriptManager { | ||||
| 		$actionName                             = ($enable ? 'en' : 'dis'); | ||||
|  | ||||
| 		$this->maniaControl->getClient()->setModeScriptSettings($scriptSettings); | ||||
| 		$this->maniaControl->log("Script Callbacks successfully {$actionName}abled!"); | ||||
| 		Logger::logInfo("Script Callbacks successfully {$actionName}abled!"); | ||||
| 		return true; | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -4,6 +4,7 @@ namespace ManiaControl\Server; | ||||
|  | ||||
| use ManiaControl\Callbacks\CallbackListener; | ||||
| use ManiaControl\Callbacks\Callbacks; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Players\Player; | ||||
| use ManiaControl\Utils\CommandLineHelper; | ||||
| @@ -399,18 +400,18 @@ class Server implements CallbackListener { | ||||
| 		$waitBegin   = time(); | ||||
| 		$maxWaitTime = 50; | ||||
| 		$lastStatus  = $response->name; | ||||
| 		$this->maniaControl->log("Waiting for server to reach status {$statusCode}..."); | ||||
| 		$this->maniaControl->log("Current Status: {$lastStatus}"); | ||||
| 		Logger::log("Waiting for server to reach status {$statusCode}..."); | ||||
| 		Logger::log("Current Status: {$lastStatus}"); | ||||
| 		while ($response->code !== 4) { | ||||
| 			sleep(1); | ||||
| 			$response = $this->maniaControl->getClient()->getStatus(); | ||||
| 			if ($lastStatus !== $response->name) { | ||||
| 				$this->maniaControl->log("New Status: {$response->name}"); | ||||
| 				Logger::log("New Status: {$response->name}"); | ||||
| 				$lastStatus = $response->name; | ||||
| 			} | ||||
| 			if (time() - $maxWaitTime > $waitBegin) { | ||||
| 				// 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; | ||||
| 			} | ||||
| 		} | ||||
|   | ||||
| @@ -3,6 +3,7 @@ | ||||
| namespace ManiaControl\Server; | ||||
|  | ||||
| use ManiaControl\Callbacks\TimerListener; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Utils\Formatter; | ||||
| use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; | ||||
| @@ -80,7 +81,7 @@ class UsageReporter implements TimerListener { | ||||
| 		$this->maniaControl->getFileReader()->loadFile($url, function ($response, $error) { | ||||
| 			$response = json_decode($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) { | ||||
| 			$this->maniaControl->getChat()->sendInformation($message, $player); | ||||
| 		} | ||||
| 		$this->maniaControl->log($message); | ||||
| 		Logger::log($message); | ||||
|  | ||||
| 		$this->maniaControl->getPluginManager()->fetchPluginList(function ($data, $error) use (&$player) { | ||||
| 			if (!$data || $error) { | ||||
| @@ -80,7 +80,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | ||||
| 				if ($player) { | ||||
| 					$this->maniaControl->getChat()->sendError($message, $player); | ||||
| 				} | ||||
| 				$this->maniaControl->log($message); | ||||
| 				Logger::logError($message); | ||||
| 				return; | ||||
| 			} | ||||
|  | ||||
| @@ -103,7 +103,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | ||||
| 					if ($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) { | ||||
| 					$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||
| 				} | ||||
| 				$this->maniaControl->log($message); | ||||
| 				Logger::log($message); | ||||
| 			} else { | ||||
| 				$updatesCount = count($pluginUpdates); | ||||
| 				$message      = "Plugins Update Check completed: There are {$updatesCount} Updates available!"; | ||||
| 				if ($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) { | ||||
| 				$this->maniaControl->getChat()->sendInformation($message, $player); | ||||
| 			} | ||||
| 			$this->maniaControl->log($message); | ||||
| 			Logger::log($message); | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| @@ -177,7 +177,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | ||||
| 		if ($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); | ||||
| 		if ($performBackup && !BackupUtil::performPluginsBackup()) { | ||||
| @@ -185,7 +185,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | ||||
| 			if ($player) { | ||||
| 				$this->maniaControl->getChat()->sendError($message, $player); | ||||
| 			} | ||||
| 			$this->maniaControl->log($message); | ||||
| 			Logger::logError($message); | ||||
| 		} | ||||
|  | ||||
| 		foreach ($pluginsUpdates as $pluginUpdateData) { | ||||
| @@ -246,7 +246,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | ||||
| 				if ($player) { | ||||
| 					$this->maniaControl->getChat()->sendInformation($message, $player); | ||||
| 				} | ||||
| 				$this->maniaControl->log($message); | ||||
| 				Logger::logError($message); | ||||
| 				return; | ||||
| 			} | ||||
|  | ||||
| @@ -258,7 +258,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | ||||
| 			if ($player) { | ||||
| 				$this->maniaControl->getChat()->sendInformation($message, $player); | ||||
| 			} | ||||
| 			$this->maniaControl->log($message); | ||||
| 			Logger::log($message); | ||||
|  | ||||
| 			$tempDir        = FileUtil::getTempFolder(); | ||||
| 			$updateFileName = $tempDir . $pluginUpdateData->zipfile; | ||||
| @@ -297,7 +297,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | ||||
| 			if ($player) { | ||||
| 				$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||
| 			} | ||||
| 			$this->maniaControl->log($message); | ||||
| 			Logger::log($message); | ||||
|  | ||||
| 			if (!$update) { | ||||
| 				$newPluginClasses = $this->maniaControl->getPluginManager()->loadPlugins(); | ||||
| @@ -306,13 +306,13 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | ||||
| 					if ($player) { | ||||
| 						$this->maniaControl->getChat()->sendError($message, $player); | ||||
| 					} | ||||
| 					$this->maniaControl->log($message); | ||||
| 					Logger::log($message); | ||||
| 				} else { | ||||
| 					$message = "Successfully loaded fresh installed Plugin '{$pluginUpdateData->pluginName}'!"; | ||||
| 					if ($player) { | ||||
| 						$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||
| 					} | ||||
| 					$this->maniaControl->log($message); | ||||
| 					Logger::log($message); | ||||
|  | ||||
| 					$this->maniaControl->getConfigurator()->showMenu($player, InstallMenu::getTitle()); | ||||
| 				} | ||||
|   | ||||
| @@ -8,6 +8,7 @@ use ManiaControl\Callbacks\TimerListener; | ||||
| use ManiaControl\Commands\CommandListener; | ||||
| use ManiaControl\Files\BackupUtil; | ||||
| use ManiaControl\Files\FileUtil; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Players\Player; | ||||
| use ManiaControl\Players\PlayerManager; | ||||
| @@ -141,7 +142,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | ||||
|  | ||||
| 		$this->maniaControl->getFileReader()->loadFile($url, function ($dataJson, $error) use (&$function) { | ||||
| 			if ($error) { | ||||
| 				$this->maniaControl->log('Error on UpdateCheck: ' . $error); | ||||
| 				Logger::logError('Error on UpdateCheck: ' . $error); | ||||
| 				return; | ||||
| 			} | ||||
| 			$versions = json_decode($dataJson); | ||||
| @@ -180,15 +181,15 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | ||||
| 		} | ||||
| 		if (!$this->checkUpdateDataBuildVersion($updateData)) { | ||||
| 			// 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; | ||||
| 		} | ||||
|  | ||||
| 		if ($this->coreUpdateData != $updateData) { | ||||
| 			if ($this->isNightlyUpdateChannel()) { | ||||
| 				$this->maniaControl->log("New Nightly Build ({$updateData->releaseDate}) available!"); | ||||
| 				Logger::log("New Nightly Build ({$updateData->releaseDate}) available!"); | ||||
| 			} else { | ||||
| 				$this->maniaControl->log("New ManiaControl Version {$updateData->version} available!"); | ||||
| 				Logger::log("New ManiaControl Version {$updateData->version} available!"); | ||||
| 			} | ||||
| 			$this->setCoreUpdateData($updateData); | ||||
| 		} | ||||
| @@ -300,11 +301,11 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | ||||
| 			if ($player) { | ||||
| 				$this->maniaControl->getChat()->sendError($message, $player); | ||||
| 			} | ||||
| 			$this->maniaControl->log($message); | ||||
| 			Logger::logError($message); | ||||
| 			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'); | ||||
| 		if (!FileUtil::checkWritePermissions($directories)) { | ||||
| @@ -312,7 +313,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | ||||
| 			if ($player) { | ||||
| 				$this->maniaControl->getChat()->sendError($message, $player); | ||||
| 			} | ||||
| 			$this->maniaControl->log($message); | ||||
| 			Logger::logError($message); | ||||
| 			return false; | ||||
| 		} | ||||
|  | ||||
| @@ -322,7 +323,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | ||||
| 			if ($player) { | ||||
| 				$this->maniaControl->getChat()->sendError($message, $player); | ||||
| 			} | ||||
| 			$this->maniaControl->log($message); | ||||
| 			Logger::logError($message); | ||||
| 		} | ||||
|  | ||||
| 		$updateData = $this->coreUpdateData; | ||||
| @@ -334,7 +335,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | ||||
| 				if ($player) { | ||||
| 					$this->maniaControl->getChat()->sendError($message, $player); | ||||
| 				} | ||||
| 				$this->maniaControl->log($message); | ||||
| 				Logger::logError($message); | ||||
| 				return; | ||||
| 			} | ||||
|  | ||||
| @@ -344,7 +345,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | ||||
| 				if ($player) { | ||||
| 					$this->maniaControl->getChat()->sendError($message, $player); | ||||
| 				} | ||||
| 				$this->maniaControl->log($message); | ||||
| 				Logger::logError($message); | ||||
| 				return; | ||||
| 			} | ||||
| 			$updateFileName = $tempDir . basename($updateData->url); | ||||
| @@ -355,7 +356,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | ||||
| 				if ($player) { | ||||
| 					$this->maniaControl->getChat()->sendError($message, $player); | ||||
| 				} | ||||
| 				$this->maniaControl->log($message); | ||||
| 				Logger::logError($message); | ||||
| 				return; | ||||
| 			} | ||||
|  | ||||
| @@ -366,7 +367,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | ||||
| 				if ($player) { | ||||
| 					$this->maniaControl->getChat()->sendError($message, $player); | ||||
| 				} | ||||
| 				$this->maniaControl->log($message); | ||||
| 				Logger::logError($message); | ||||
| 				unlink($updateFileName); | ||||
| 				return; | ||||
| 			} | ||||
| @@ -383,7 +384,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | ||||
| 			if ($player) { | ||||
| 				$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||
| 			} | ||||
| 			$this->maniaControl->log($message); | ||||
| 			Logger::log($message); | ||||
|  | ||||
| 			$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->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) { | ||||
| 				$this->maniaControl->log("Dedimania Error: '{$error}'"); | ||||
| 				Logger::logError("Dedimania Error: '{$error}'"); | ||||
| 			} | ||||
|  | ||||
| 			$data = $this->decode($data); | ||||
| @@ -216,11 +216,11 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | ||||
| 			$responseData                   = $methodResponse[0]; | ||||
| 			$this->dedimaniaData->sessionId = $responseData['SessionId']; | ||||
| 			if ($this->dedimaniaData->sessionId) { | ||||
| 				$this->maniaControl->log("Dedimania connection successfully established."); | ||||
| 				Logger::log("Dedimania connection successfully established."); | ||||
| 				$this->fetchDedimaniaRecords(); | ||||
| 				$this->init = true; | ||||
| 			} else { | ||||
| 				$this->maniaControl->log("Error while opening Dedimania Connection"); | ||||
| 				Logger::logError("Error while opening Dedimania Connection"); | ||||
| 			} | ||||
|  | ||||
| 			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->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||
| 			if ($error) { | ||||
| 				$this->maniaControl->log('Dedimania Error: ' . $error); | ||||
| 				Logger::logError('Dedimania Error: ' . $error); | ||||
| 			} | ||||
|  | ||||
| 			$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->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||
| 			if ($error) { | ||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | ||||
| 				Logger::logError("Dedimania Error: " . $error); | ||||
| 			} | ||||
|  | ||||
| 			$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) { | ||||
| 			if ($error) { | ||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | ||||
| 				Logger::logError("Dedimania Error: " . $error); | ||||
| 			} | ||||
|  | ||||
| 			$data = $this->decode($data); | ||||
| @@ -663,7 +663,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | ||||
|  | ||||
| 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||
| 			if ($error) { | ||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | ||||
| 				Logger::logError("Dedimania Error: " . $error); | ||||
| 			} | ||||
|  | ||||
| 			$data = $this->decode($data); | ||||
| @@ -733,7 +733,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | ||||
|  | ||||
| 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||
| 			if ($error) { | ||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | ||||
| 				Logger::logError("Dedimania Error: " . $error); | ||||
| 			} | ||||
|  | ||||
| 			if (self::DEDIMANIA_DEBUG) { | ||||
| @@ -783,7 +783,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | ||||
|  | ||||
| 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||
| 			if ($error) { | ||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | ||||
| 				Logger::logError("Dedimania Error: " . $error); | ||||
| 			} | ||||
|  | ||||
| 			$data = $this->decode($data); | ||||
|   | ||||
| @@ -12,6 +12,7 @@ use ManiaControl\Callbacks\CallbackManager; | ||||
| use ManiaControl\Callbacks\Callbacks; | ||||
| use ManiaControl\Callbacks\TimerListener; | ||||
| use ManiaControl\Files\AsynchronousFileReader; | ||||
| use ManiaControl\Logger; | ||||
| use ManiaControl\ManiaControl; | ||||
| use ManiaControl\Maps\Map; | ||||
| use ManiaControl\Players\Player; | ||||
| @@ -265,7 +266,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | ||||
| 				$this->mxKarma['session'] = $data->data; | ||||
| 				$this->activateSession($mxKarmaCode); | ||||
| 			} else { | ||||
| 				$this->maniaControl->log("Error while authenticating on Mania-Exchange Karma"); | ||||
| 				Logger::logError("Error while authenticating on Mania-Exchange Karma"); | ||||
| 				// TODO remove temp trigger | ||||
| 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('auth error', $data->data->message); | ||||
| 				$this->mxKarma['connectionInProgress'] = false; | ||||
| @@ -297,7 +298,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | ||||
| 				return; | ||||
| 			} | ||||
| 			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 | ||||
| 				$this->getMxKarmaVotes(); | ||||
| @@ -308,7 +309,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | ||||
| 				} else { | ||||
| 					$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']); | ||||
| 			} | ||||
| 		}, AsynchronousFileReader::CONTENT_TYPE_JSON, 1000); | ||||
| @@ -397,10 +398,10 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | ||||
|  | ||||
| 				$this->updateManialink = true; | ||||
| 				$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 { | ||||
| 				// 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') { | ||||
| 					unset($this->mxKarma['session']); | ||||
| 				} else { | ||||
| @@ -496,10 +497,10 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | ||||
| 				return; | ||||
| 			} | ||||
| 			if ($data->success) { | ||||
| 				$this->maniaControl->log('Votes successfully submitted!'); | ||||
| 				Logger::logInfo('Votes successfully submitted!'); | ||||
| 			} else { | ||||
| 				// 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") { | ||||
| 					unset($this->mxKarma['session']); | ||||
| 				} else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user