use static package method when checking for plugin updates from dashboard page

This commit is contained in:
Luke Pulverenti 2013-06-28 09:26:27 -04:00
parent 28be50b0f1
commit 1e49857765
7 changed files with 10 additions and 10 deletions

View File

@ -132,7 +132,7 @@ namespace MediaBrowser.Api
if (request.PackageType == PackageType.UserInstalled || request.PackageType == PackageType.All)
{
result.AddRange(_installationManager.GetAvailablePluginUpdates(false, CancellationToken.None).Result.ToList());
result.AddRange(_installationManager.GetAvailablePluginUpdatesWithoutRegistrationInfo(false, CancellationToken.None).Result.ToList());
}
else if (request.PackageType == PackageType.System || request.PackageType == PackageType.All)

View File

@ -70,7 +70,7 @@ namespace MediaBrowser.Common.Implementations.Updates
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task<IEnumerable<PackageInfo>> GetAvailablePackagesStatic(CancellationToken cancellationToken)
public async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken)
{
using (var json = await _httpClient.Get(Constants.Constants.MbAdminUrl + "service/MB3Packages.json", cancellationToken).ConfigureAwait(false))
{

View File

@ -20,7 +20,7 @@ namespace MediaBrowser.Common.Updates
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{List{PackageInfo}}.</returns>
Task<IEnumerable<PackageInfo>> GetAvailablePackagesStatic(CancellationToken cancellationToken);
Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken);
/// <summary>
/// Installs a package.

View File

@ -92,7 +92,7 @@ namespace MediaBrowser.Controller.Updates
/// <param name="withAutoUpdateEnabled">if set to <c>true</c> [with auto update enabled].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns>
Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdatesStatic(bool withAutoUpdateEnabled, CancellationToken cancellationToken);
Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdatesWithoutRegistrationInfo(bool withAutoUpdateEnabled, CancellationToken cancellationToken);
/// <summary>
/// Installs the package.

View File

@ -60,7 +60,7 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
{
progress.Report(0);
var packagesToInstall = (await _installationManager.GetAvailablePluginUpdatesStatic(true, cancellationToken).ConfigureAwait(false)).ToList();
var packagesToInstall = (await _installationManager.GetAvailablePluginUpdatesWithoutRegistrationInfo(true, cancellationToken).ConfigureAwait(false)).ToList();
progress.Report(10);

View File

@ -181,11 +181,11 @@ namespace MediaBrowser.Server.Implementations.Updates
/// <param name="packageType">Type of the package.</param>
/// <param name="applicationVersion">The application version.</param>
/// <returns>Task{List{PackageInfo}}.</returns>
protected async Task<IEnumerable<PackageInfo>> GetAvailablePackagesStatic(CancellationToken cancellationToken,
protected async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken,
PackageType? packageType = null,
Version applicationVersion = null)
{
var packages = (await _packageManager.GetAvailablePackagesStatic(cancellationToken).ConfigureAwait(false)).ToList();
var packages = (await _packageManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false)).ToList();
return FilterPackages(packages, packageType, applicationVersion);
}
@ -304,9 +304,9 @@ namespace MediaBrowser.Server.Implementations.Updates
/// <param name="withAutoUpdateEnabled">if set to <c>true</c> [with auto update enabled].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns>
public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdatesStatic(bool withAutoUpdateEnabled, CancellationToken cancellationToken)
public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdatesWithoutRegistrationInfo(bool withAutoUpdateEnabled, CancellationToken cancellationToken)
{
var catalog = await GetAvailablePackagesStatic(cancellationToken).ConfigureAwait(false);
var catalog = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
return FilterCatalog(catalog, withAutoUpdateEnabled);
}

View File

@ -474,7 +474,7 @@ namespace MediaBrowser.ServerApplication
/// <returns>Task{CheckForUpdateResult}.</returns>
public async override Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
{
var availablePackages = await PackageManager.GetAvailablePackagesStatic(CancellationToken.None).ConfigureAwait(false);
var availablePackages = await PackageManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None).ConfigureAwait(false);
var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MbServerPkgName, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } :