From 81af68838bbde6397ff4b10357fae1d717003b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Tue, 15 Apr 2014 11:33:06 +0200 Subject: [PATCH] php 5.3 compatibility changes --- application/core/Update/UpdateManager.php | 26 ++++++++++++++------- application/plugins/Dedimania/Dedimania.php | 3 ++- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/application/core/Update/UpdateManager.php b/application/core/Update/UpdateManager.php index 54fd9eb3..477da37c 100644 --- a/application/core/Update/UpdateManager.php +++ b/application/core/Update/UpdateManager.php @@ -91,18 +91,20 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener } //Check if a new Core Update is Available - $this->checkCoreUpdateAsync(function (UpdateData $updateData) use ($time) { - $buildDate = strtotime($this->currentBuildDate); + $self = $this; + $maniaControl = $this->maniaControl; + $this->checkCoreUpdateAsync(function (UpdateData $updateData) use ($self, $maniaControl, $time) { + $buildDate = strtotime($self->getCurrentBuildDate()); $releaseTime = strtotime($updateData->releaseDate); if ($buildDate < $releaseTime) { - $updateChannel = $this->maniaControl->settingManager->getSetting($this, self::SETTING_UPDATECHECK_CHANNEL); - if ($updateChannel != self::CHANNEL_NIGHTLY) { - $this->maniaControl->log('New ManiaControl Version ' . $updateData->version . ' available!'); + $updateChannel = $maniaControl->settingManager->getSetting($self, UpdateManager::SETTING_UPDATECHECK_CHANNEL); + if ($updateChannel != UpdateManager::CHANNEL_NIGHTLY) { + $maniaControl->log('New ManiaControl Version ' . $updateData->version . ' available!'); } else { - $this->maniaControl->log('New Nightly Build (' . $updateData->releaseDate . ') available!'); + $maniaControl->log('New Nightly Build (' . $updateData->releaseDate . ') available!'); } - $this->coreUpdateData = $updateData; - $this->autoUpdate($time); + $self->setCoreUpdateData($updateData); + $self->autoUpdate($time); } }, true); } @@ -326,6 +328,14 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener return $pluginData; } + /** + * Set Core Update Data + * + * @param UpdateData $coreUpdateData + */ + public function setCoreUpdateData(UpdateData $coreUpdateData = null) { + $this->coreUpdateData = $coreUpdateData; + } /** * Checks a core update Asynchronously diff --git a/application/plugins/Dedimania/Dedimania.php b/application/plugins/Dedimania/Dedimania.php index 6496c351..3f498939 100644 --- a/application/plugins/Dedimania/Dedimania.php +++ b/application/plugins/Dedimania/Dedimania.php @@ -809,7 +809,8 @@ class Dedimania implements CallbackListener, TimerListener, Plugin { */ private function getGameModeString() { $gameMode = $this->maniaControl->server->getGameMode(); - $scriptName = str_replace('.Script.txt', '', $this->maniaControl->client->getScriptName()["CurrentValue"]); + $scriptNameResponse = $this->maniaControl->client->getScriptName(); + $scriptName = str_replace('.Script.txt', '', $scriptNameResponse["CurrentValue"]); if ($gameMode === null) { trigger_error("Couldn't retrieve game mode. "); return null;