2
0
Эх сурвалжийг харах

Add tracking of JF version used to run this config previously

Vasily 5 жил өмнө
parent
commit
acd67c7152

+ 10 - 0
Jellyfin.Server/CoreAppHost.cs

@@ -41,6 +41,16 @@ 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 />

+ 21 - 0
MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs

@@ -1,3 +1,6 @@
+using System;
+using System.Xml.Serialization;
+
 namespace MediaBrowser.Model.Configuration
 {
     /// <summary>
@@ -25,6 +28,24 @@ namespace MediaBrowser.Model.Configuration
         /// <value>The cache path.</value>
         public string CachePath { get; set; }
 
+        /// <summary>
+        /// Last known version that was ran using the configuration.
+        /// </summary>
+        /// <value>The version from previous run.</value>
+        [XmlIgnore]
+        public Version PreviousVersion { get; set; }
+
+        /// <summary>
+        /// Stringified PreviousVersion to be stored/loaded,
+        /// because System.Version itself isn't xml-serializable
+        /// </summary>
+        /// <value>String value of PreviousVersion</value>
+        public string PreviousVersionStr
+        {
+            get => PreviousVersion?.ToString();
+            set => PreviousVersion = Version.Parse(value);
+        }
+
         /// <summary>
         /// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
         /// </summary>