Start on new update routines

This commit is contained in:
Eric Reed 2013-02-28 14:29:17 -05:00
parent 0180e89310
commit 989bb48596
4 changed files with 24 additions and 11 deletions

View File

@ -123,10 +123,7 @@ namespace MediaBrowser.Api
if (updateCheckResult.IsUpdateAvailable)
{
result.Add(new PackageVersionInfo
{
versionStr = updateCheckResult.AvailableVersion.ToString()
});
result.Add(updateCheckResult.Package);
}
}

View File

@ -8,6 +8,6 @@ namespace MediaBrowser.Common.Constants
{
public static class Constants
{
public const string MBAdminUrl = "http://mb3admin.com/admin/";
public const string MBAdminUrl = "http://www.mb3admin.com/admin/";
}
}

View File

@ -17,6 +17,15 @@ namespace MediaBrowser.Model.Updates
/// Gets or sets the available version.
/// </summary>
/// <value>The available version.</value>
public Version AvailableVersion { get; set; }
public Version AvailableVersion
{
get { return Package != null ? Package.version : new Version(0, 0); }
set { } // need this for the serializer
}
/// <summary>
/// Get or sets package information for an available update
/// </summary>
public PackageVersionInfo Package { get; set; }
}
}

View File

@ -1,4 +1,5 @@
using BDInfo;
using System.Security;
using BDInfo;
using MediaBrowser.ClickOnce;
using MediaBrowser.Common.Implementations;
using MediaBrowser.Common.Implementations.HttpClientManager;
@ -13,6 +14,8 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Common.Security;
using MediaBrowser.Common.Updates;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Library;
using MediaBrowser.IsoMounter;
@ -145,7 +148,7 @@ namespace MediaBrowser.ServerApplication
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
public bool CanSelfUpdate
{
get { return ClickOnceHelper.IsNetworkDeployed; }
get { return true; }
}
/// <summary>
@ -154,10 +157,14 @@ namespace MediaBrowser.ServerApplication
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress.</param>
/// <returns>Task{CheckForUpdateResult}.</returns>
public Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
public async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
{
// Get package manager using Resolve<IPackageManager>()
return new ApplicationUpdateCheck().CheckForApplicationUpdate(cancellationToken, progress);
var pkgManager = Resolve<IPackageManager>();
var availablePackages = await pkgManager.GetAvailablePackages(Resolve<IHttpClient>(), Resolve<INetworkManager>(), Kernel.SecurityManager, Kernel.ResourcePools, Resolve<IJsonSerializer>(), CancellationToken.None).ConfigureAwait(false);
var version = Kernel.InstallationManager.GetLatestCompatibleVersion(availablePackages, "MBServer", Kernel.Configuration.SystemUpdateLevel);
return version != null ? new CheckForUpdateResult {AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version} :
new CheckForUpdateResult();
}
/// <summary>