Check for newer pluginversions at startup

This commit is contained in:
Max Klaversma 2014-04-15 23:49:27 +02:00 committed by Steffen Schröder
parent 6e37411fc4
commit c0b9263b97
2 changed files with 13 additions and 1 deletions

View File

@ -306,6 +306,7 @@ class ManiaControl implements CommandListener, TimerListener {
// Load plugins
$this->pluginManager->loadPlugins();
$this->updateManager->checkPluginsUpdate();
// AfterInit callback
$this->callbackManager->triggerCallback(CallbackManager::CB_AFTERINIT);

View File

@ -302,6 +302,17 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
}, true);
}
public function checkPluginsUpdate() {
$this->maniaControl->log('[UPDATE] Checking plugins for newer versions ...');
foreach($this->maniaControl->pluginManager->getPluginClasses() as $pluginClass) {
$pluginData = $this->checkPluginUpdate($pluginClass);
if($pluginData != false) {
$this->maniaControl->log('[UPDATE] '.$pluginClass.': There is a newer version available: '.$pluginData->currentVersion->version.'!');
}
}
$this->maniaControl->log('[UPDATE] Checking plugins: COMPLETE!');
}
/**
* Check given Plugin Class for Update
*
@ -322,7 +333,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
}
$pluginData = $pluginVersions[0];
$pluginVersion = $pluginClass::getVersion();
if ($pluginData->version <= $pluginVersion) {
if ($pluginData->currentVersion->version <= $pluginVersion) {
return false;
}
return $pluginData;