php 5.3 compatibility changes

This commit is contained in:
Steffen Schröder 2014-04-15 11:33:06 +02:00
parent 2db2c88554
commit 81af68838b
2 changed files with 20 additions and 9 deletions

View File

@ -91,18 +91,20 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
} }
//Check if a new Core Update is Available //Check if a new Core Update is Available
$this->checkCoreUpdateAsync(function (UpdateData $updateData) use ($time) { $self = $this;
$buildDate = strtotime($this->currentBuildDate); $maniaControl = $this->maniaControl;
$this->checkCoreUpdateAsync(function (UpdateData $updateData) use ($self, $maniaControl, $time) {
$buildDate = strtotime($self->getCurrentBuildDate());
$releaseTime = strtotime($updateData->releaseDate); $releaseTime = strtotime($updateData->releaseDate);
if ($buildDate < $releaseTime) { if ($buildDate < $releaseTime) {
$updateChannel = $this->maniaControl->settingManager->getSetting($this, self::SETTING_UPDATECHECK_CHANNEL); $updateChannel = $maniaControl->settingManager->getSetting($self, UpdateManager::SETTING_UPDATECHECK_CHANNEL);
if ($updateChannel != self::CHANNEL_NIGHTLY) { if ($updateChannel != UpdateManager::CHANNEL_NIGHTLY) {
$this->maniaControl->log('New ManiaControl Version ' . $updateData->version . ' available!'); $maniaControl->log('New ManiaControl Version ' . $updateData->version . ' available!');
} else { } else {
$this->maniaControl->log('New Nightly Build (' . $updateData->releaseDate . ') available!'); $maniaControl->log('New Nightly Build (' . $updateData->releaseDate . ') available!');
} }
$this->coreUpdateData = $updateData; $self->setCoreUpdateData($updateData);
$this->autoUpdate($time); $self->autoUpdate($time);
} }
}, true); }, true);
} }
@ -326,6 +328,14 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
return $pluginData; return $pluginData;
} }
/**
* Set Core Update Data
*
* @param UpdateData $coreUpdateData
*/
public function setCoreUpdateData(UpdateData $coreUpdateData = null) {
$this->coreUpdateData = $coreUpdateData;
}
/** /**
* Checks a core update Asynchronously * Checks a core update Asynchronously

View File

@ -809,7 +809,8 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
*/ */
private function getGameModeString() { private function getGameModeString() {
$gameMode = $this->maniaControl->server->getGameMode(); $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) { if ($gameMode === null) {
trigger_error("Couldn't retrieve game mode. "); trigger_error("Couldn't retrieve game mode. ");
return null; return null;