| 
														
															@@ -1,6 +1,7 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 using System; 
														 | 
														
														 | 
														
															 using System; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 using System.Linq; 
														 | 
														
														 | 
														
															 using System.Linq; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 using MediaBrowser.Common.Configuration; 
														 | 
														
														 | 
														
															 using MediaBrowser.Common.Configuration; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+using Microsoft.Extensions.DependencyInjection; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 using Microsoft.Extensions.Logging; 
														 | 
														
														 | 
														
															 using Microsoft.Extensions.Logging; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 namespace Jellyfin.Server.Migrations 
														 | 
														
														 | 
														
															 namespace Jellyfin.Server.Migrations 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -13,10 +14,10 @@ namespace Jellyfin.Server.Migrations 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         /// <summary> 
														 | 
														
														 | 
														
															         /// <summary> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         /// The list of known migrations, in order of applicability. 
														 | 
														
														 | 
														
															         /// The list of known migrations, in order of applicability. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         /// </summary> 
														 | 
														
														 | 
														
															         /// </summary> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        internal static readonly IMigrationRoutine[] Migrations = 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        private static readonly Type[] _migrationTypes = 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         { 
														 | 
														
														 | 
														
															         { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            new Routines.DisableTranscodingThrottling(), 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            new Routines.CreateUserLoggingConfigFile() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            typeof(Routines.DisableTranscodingThrottling), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            typeof(Routines.CreateUserLoggingConfigFile) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }; 
														 | 
														
														 | 
														
															         }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         /// <summary> 
														 | 
														
														 | 
														
															         /// <summary> 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -27,6 +28,10 @@ namespace Jellyfin.Server.Migrations 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         public static void Run(CoreAppHost host, ILoggerFactory loggerFactory) 
														 | 
														
														 | 
														
															         public static void Run(CoreAppHost host, ILoggerFactory loggerFactory) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         { 
														 | 
														
														 | 
														
															         { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             var logger = loggerFactory.CreateLogger<MigrationRunner>(); 
														 | 
														
														 | 
														
															             var logger = loggerFactory.CreateLogger<MigrationRunner>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            var migrations = _migrationTypes 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                .Select(m => ActivatorUtilities.CreateInstance(host.ServiceProvider, m)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                .OfType<IMigrationRoutine>() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                .ToArray(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             var migrationOptions = ((IConfigurationManager)host.ServerConfigurationManager).GetConfiguration<MigrationOptions>(MigrationsListStore.StoreKey); 
														 | 
														
														 | 
														
															             var migrationOptions = ((IConfigurationManager)host.ServerConfigurationManager).GetConfiguration<MigrationOptions>(MigrationsListStore.StoreKey); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															             if (!host.ServerConfigurationManager.Configuration.IsStartupWizardCompleted && migrationOptions.Applied.Count == 0) 
														 | 
														
														 | 
														
															             if (!host.ServerConfigurationManager.Configuration.IsStartupWizardCompleted && migrationOptions.Applied.Count == 0) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -34,16 +39,16 @@ namespace Jellyfin.Server.Migrations 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 // If startup wizard is not finished, this is a fresh install. 
														 | 
														
														 | 
														
															                 // If startup wizard is not finished, this is a fresh install. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 // Don't run any migrations, just mark all of them as applied. 
														 | 
														
														 | 
														
															                 // Don't run any migrations, just mark all of them as applied. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 logger.LogInformation("Marking all known migrations as applied because this is a fresh install"); 
														 | 
														
														 | 
														
															                 logger.LogInformation("Marking all known migrations as applied because this is a fresh install"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                migrationOptions.Applied.AddRange(Migrations.Select(m => (m.Id, m.Name))); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                migrationOptions.Applied.AddRange(migrations.Select(m => (m.Id, m.Name))); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 host.ServerConfigurationManager.SaveConfiguration(MigrationsListStore.StoreKey, migrationOptions); 
														 | 
														
														 | 
														
															                 host.ServerConfigurationManager.SaveConfiguration(MigrationsListStore.StoreKey, migrationOptions); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 return; 
														 | 
														
														 | 
														
															                 return; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															             var appliedMigrationIds = migrationOptions.Applied.Select(m => m.Id).ToHashSet(); 
														 | 
														
														 | 
														
															             var appliedMigrationIds = migrationOptions.Applied.Select(m => m.Id).ToHashSet(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            for (var i = 0; i < Migrations.Length; i++) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            for (var i = 0; i < migrations.Length; i++) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             { 
														 | 
														
														 | 
														
															             { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                var migrationRoutine = Migrations[i]; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                var migrationRoutine = migrations[i]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 if (appliedMigrationIds.Contains(migrationRoutine.Id)) 
														 | 
														
														 | 
														
															                 if (appliedMigrationIds.Contains(migrationRoutine.Id)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 { 
														 | 
														
														 | 
														
															                 { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     logger.LogDebug("Skipping migration '{Name}' since it is already applied", migrationRoutine.Name); 
														 | 
														
														 | 
														
															                     logger.LogDebug("Skipping migration '{Name}' since it is already applied", migrationRoutine.Name); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -54,7 +59,7 @@ namespace Jellyfin.Server.Migrations 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 try 
														 | 
														
														 | 
														
															                 try 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 { 
														 | 
														
														 | 
														
															                 { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    migrationRoutine.Perform(host, logger); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    migrationRoutine.Perform(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 } 
														 | 
														
														 | 
														
															                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 catch (Exception ex) 
														 | 
														
														 | 
														
															                 catch (Exception ex) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 { 
														 | 
														
														 | 
														
															                 { 
														 |