added HasUpdateAvailable

This commit is contained in:
Luke Pulverenti
2014-01-05 01:50:48 -05:00
parent 178d216b28
commit a01ee815fb
6 changed files with 46 additions and 3 deletions

View File

@@ -293,7 +293,7 @@ namespace MediaBrowser.ServerApplication
await Task.WhenAll(itemsTask, displayPreferencesTask, userdataTask).ConfigureAwait(false);
progress.Report(100);
await ((UserManager) UserManager).Initialize().ConfigureAwait(false);
await ((UserManager)UserManager).Initialize().ConfigureAwait(false);
SetKernelProperties();
}
@@ -628,7 +628,8 @@ namespace MediaBrowser.ServerApplication
OperatingSystem = Environment.OSVersion.ToString(),
CanSelfRestart = CanSelfRestart,
CanSelfUpdate = CanSelfUpdate,
WanAddress = GetWanAddress()
WanAddress = GetWanAddress(),
HasUpdateAvailable = _hasUpdateAvailable
};
}
@@ -699,6 +700,7 @@ namespace MediaBrowser.ServerApplication
}
}
private bool _hasUpdateAvailable;
/// <summary>
/// Checks for update.
/// </summary>
@@ -712,6 +714,8 @@ namespace MediaBrowser.ServerApplication
var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MbServerPkgName, null, ApplicationVersion,
ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
_hasUpdateAvailable = version != null;
return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } :
new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false };
}
@@ -727,6 +731,8 @@ namespace MediaBrowser.ServerApplication
{
await InstallationManager.InstallPackage(package, progress, cancellationToken).ConfigureAwait(false);
_hasUpdateAvailable = false;
OnApplicationUpdated(package.version);
}