update manager improvements
This commit is contained in:
parent
dcb4e3f951
commit
df4b11cc6b
@ -62,11 +62,13 @@ class UpdateManager implements CallbackListener, CommandListener {
|
||||
public function handle1Minute(array $callback) {
|
||||
$updateCheckEnabled = $this->maniaControl->settingManager->getSetting($this, self::SETTING_ENABLEUPDATECHECK);
|
||||
if (!$updateCheckEnabled) {
|
||||
// Automatic update check disabled
|
||||
if ($this->coreUpdateData) {
|
||||
$this->coreUpdateData = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Only check once per hour
|
||||
$updateInterval = $this->maniaControl->settingManager->getSetting($this, self::SETTING_UPDATECHECK_INTERVAL);
|
||||
if ($this->lastUpdateCheck > time() - $updateInterval * 3600.) {
|
||||
return;
|
||||
@ -74,6 +76,7 @@ class UpdateManager implements CallbackListener, CommandListener {
|
||||
$this->lastUpdateCheck = time();
|
||||
$updateData = $this->checkCoreUpdate();
|
||||
if (!$updateData) {
|
||||
// No update available
|
||||
return;
|
||||
}
|
||||
$this->maniaControl->log('New ManiaControl Version ' . $updateData->version . ' available!');
|
||||
@ -89,10 +92,9 @@ class UpdateManager implements CallbackListener, CommandListener {
|
||||
if (!$this->coreUpdateData) {
|
||||
return;
|
||||
}
|
||||
// Announce available update
|
||||
$player = $callback[1];
|
||||
if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) {
|
||||
return;
|
||||
}
|
||||
if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) return;
|
||||
$this->maniaControl->chat->sendInformation('New ManiaControl Version ' . $this->coreUpdateData->version . ' available!',
|
||||
$player->login);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user