From 860aae811e23747ccb1cdf26ee21dbcf0c81b703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Fri, 30 May 2014 03:17:39 +0200 Subject: [PATCH] adjustment for new web service --- .../core/Update/PluginUpdateManager.php | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/application/core/Update/PluginUpdateManager.php b/application/core/Update/PluginUpdateManager.php index 57ea7f4b..9fd90551 100644 --- a/application/core/Update/PluginUpdateManager.php +++ b/application/core/Update/PluginUpdateManager.php @@ -210,9 +210,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis $updates = array(); $pluginClasses = $this->maniaControl->pluginManager->getPluginClasses(); foreach ($pluginClasses as $pluginClass) { - /** - * @var Plugin $pluginClass - */ + /** @var Plugin $pluginClass */ $pluginId = $pluginClass::getId(); if (isset($pluginsUpdates[$pluginId])) { /** @var PluginUpdateData $pluginUpdateData */ @@ -379,19 +377,17 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis */ public function getPluginUpdate($pluginClass) { $pluginClass = PluginManager::getPluginClass($pluginClass); - /** - * @var Plugin $pluginClass - */ - $pluginId = $pluginClass::getId(); - $url = ManiaControl::URL_WEBSERVICE . 'plugins/' . $pluginId; - $dataJson = FileUtil::loadFile($url); - $pluginVersions = json_decode($dataJson); - if (!$pluginVersions || !isset($pluginVersions[0])) { + /** @var Plugin $pluginClass */ + $pluginId = $pluginClass::getId(); + $url = ManiaControl::URL_WEBSERVICE . 'plugins/' . $pluginId; + $dataJson = FileUtil::loadFile($url); + $pluginVersion = json_decode($dataJson); + if (!$pluginVersion) { return false; } - $pluginUpdateData = new PluginUpdateData($pluginVersions[0]); - $pluginVersion = $pluginClass::getVersion(); - if ($pluginUpdateData->isNewerThan($pluginVersion)) { + $pluginUpdateData = new PluginUpdateData($pluginVersion); + $version = $pluginClass::getVersion(); + if ($pluginUpdateData->isNewerThan($version)) { return $pluginUpdateData; } return false;