fix update level migration
This commit is contained in:
parent
2ce3869fd2
commit
b15655a62d
|
@ -6,6 +6,7 @@ using MediaBrowser.Common.Implementations.Updates;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using MediaBrowser.Model.Updates;
|
using MediaBrowser.Model.Updates;
|
||||||
|
|
||||||
|
@ -18,17 +19,19 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
private readonly IJsonSerializer _jsonSerializer;
|
private readonly IJsonSerializer _jsonSerializer;
|
||||||
private readonly string _releaseAssetFilename;
|
private readonly string _releaseAssetFilename;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public UpdateLevelMigration(IServerConfigurationManager config, IServerApplicationHost appHost, IHttpClient httpClient, IJsonSerializer jsonSerializer, string releaseAssetFilename)
|
public UpdateLevelMigration(IServerConfigurationManager config, IServerApplicationHost appHost, IHttpClient httpClient, IJsonSerializer jsonSerializer, string releaseAssetFilename, ILogger logger)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
_releaseAssetFilename = releaseAssetFilename;
|
_releaseAssetFilename = releaseAssetFilename;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Run()
|
public async Task Run()
|
||||||
{
|
{
|
||||||
var lastVersion = _config.Configuration.LastVersion;
|
var lastVersion = _config.Configuration.LastVersion;
|
||||||
var currentVersion = _appHost.ApplicationVersion;
|
var currentVersion = _appHost.ApplicationVersion;
|
||||||
|
@ -44,9 +47,9 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||||
|
|
||||||
await CheckVersion(currentVersion, updateLevel, CancellationToken.None).ConfigureAwait(false);
|
await CheckVersion(currentVersion, updateLevel, CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
_logger.ErrorException("Error in update migration", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,12 +111,15 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||||
}
|
}
|
||||||
|
|
||||||
private Version ParseVersion(string versionString)
|
private Version ParseVersion(string versionString)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(versionString))
|
||||||
{
|
{
|
||||||
var parts = versionString.Split('.');
|
var parts = versionString.Split('.');
|
||||||
if (parts.Length == 3)
|
if (parts.Length == 3)
|
||||||
{
|
{
|
||||||
versionString += ".0";
|
versionString += ".0";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Version version;
|
Version version;
|
||||||
Version.TryParse(versionString, out version);
|
Version.TryParse(versionString, out version);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user