only log available update once

This commit is contained in:
Steffen Schröder 2014-05-07 21:09:13 +02:00
parent 5fdb738886
commit 5b04257c9a

View File

@ -124,7 +124,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
$this->maniaControl->fileReader->loadFile($url, function ($dataJson, $error) use (&$function) { $this->maniaControl->fileReader->loadFile($url, function ($dataJson, $error) use (&$function) {
$versions = json_decode($dataJson); $versions = json_decode($dataJson);
if (!$versions || !isset($versions[0])) { if (!$versions || !isset($versions[0])) {
call_user_func($function, null); call_user_func($function);
} else { } else {
$updateData = new UpdateData($versions[0]); $updateData = new UpdateData($versions[0]);
call_user_func($function, $updateData); call_user_func($function, $updateData);
@ -147,11 +147,11 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
} }
/** /**
* Handle the fetched Update Data * Handle the fetched Update Data of the hourly Check
* *
* @param UpdateData $updateData * @param UpdateData $updateData
*/ */
public function handleUpdateCheck(UpdateData $updateData) { public function handleUpdateCheck(UpdateData $updateData = null) {
if (!$this->checkUpdateData($updateData)) { if (!$this->checkUpdateData($updateData)) {
// No new update available // No new update available
return; return;
@ -162,12 +162,14 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
return; return;
} }
if ($this->coreUpdateData != $updateData) {
if ($this->isNightlyUpdateChannel()) { if ($this->isNightlyUpdateChannel()) {
$this->maniaControl->log("New Nightly Build ({$updateData->releaseDate}) available!"); $this->maniaControl->log("New Nightly Build ({$updateData->releaseDate}) available!");
} else { } else {
$this->maniaControl->log("New ManiaControl Version {$updateData->version} available!"); $this->maniaControl->log("New ManiaControl Version {$updateData->version} available!");
} }
$this->setCoreUpdateData($updateData); $this->setCoreUpdateData($updateData);
}
$this->checkAutoUpdate(); $this->checkAutoUpdate();
} }