diff options
| author | Vasily <just.one.man@yandex.ru> | 2020-03-05 17:41:32 +0300 |
|---|---|---|
| committer | Vasily <just.one.man@yandex.ru> | 2020-03-05 17:41:32 +0300 |
| commit | 9eef0e8ca0e3359239ab68fcadbf2d65084f12e6 (patch) | |
| tree | 11e2d805fa397a409e00905a45cbd2a538386858 /Jellyfin.Server/CoreAppHost.cs | |
| parent | acd67c7152cc9a476d5cc9e7a4b95b084bfaeb6e (diff) | |
Implement EnableThrottling migration for pre-10.5.0 to 10.5.0 or newer
Diffstat (limited to 'Jellyfin.Server/CoreAppHost.cs')
| -rw-r--r-- | Jellyfin.Server/CoreAppHost.cs | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/Jellyfin.Server/CoreAppHost.cs b/Jellyfin.Server/CoreAppHost.cs index 59285a510..cd5a2ce85 100644 --- a/Jellyfin.Server/CoreAppHost.cs +++ b/Jellyfin.Server/CoreAppHost.cs @@ -41,16 +41,6 @@ namespace Jellyfin.Server networkManager, configuration) { - var previousVersion = ConfigurationManager.CommonConfiguration.PreviousVersion; - if (ApplicationVersion.CompareTo(previousVersion) > 0) - { - Logger.LogWarning("Version check shows Jellyfin was updated: previous version={0}, current version={1}", previousVersion, ApplicationVersion); - - // TODO: run update routines - - ConfigurationManager.CommonConfiguration.PreviousVersion = ApplicationVersion; - ConfigurationManager.SaveConfiguration(); - } } /// <inheritdoc /> @@ -67,5 +57,33 @@ namespace Jellyfin.Server /// <inheritdoc /> protected override void ShutdownInternal() => Program.Shutdown(); + + /// <summary> + /// Runs the migration routines if necessary. + /// </summary> + public void TryMigrate() + { + var previousVersion = ConfigurationManager.CommonConfiguration.PreviousVersion; + switch (ApplicationVersion.CompareTo(previousVersion)) + { + case 1: + Logger.LogWarning("Version check shows Jellyfin was updated: previous version={0}, current version={1}", previousVersion, ApplicationVersion); + + Migrations.Run(this, Logger); + + ConfigurationManager.CommonConfiguration.PreviousVersion = ApplicationVersion; + ConfigurationManager.SaveConfiguration(); + break; + case 0: + // nothing to do, versions match + break; + case -1: + Logger.LogWarning("Version check shows Jellyfin was rolled back, use at your own risk: previous version={0}, current version={1}", previousVersion, ApplicationVersion); + // no "rollback" routines for now + ConfigurationManager.CommonConfiguration.PreviousVersion = ApplicationVersion; + ConfigurationManager.SaveConfiguration(); + break; + } + } } } |
