diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-10-16 14:11:11 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-10-16 14:11:11 -0400 |
| commit | a0b1ddf0a7fbe285ce44a971a6f073895b8c2521 (patch) | |
| tree | 2191ebcb5c632fe24db9a43fc197b7ce04349cc6 /MediaBrowser.Server.Startup.Common/Migrations | |
| parent | f5f52853060c733ecb19612fbd822688673b495e (diff) | |
add migrations for new release
Diffstat (limited to 'MediaBrowser.Server.Startup.Common/Migrations')
| -rw-r--r-- | MediaBrowser.Server.Startup.Common/Migrations/Release5767.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Startup.Common/Migrations/Release5767.cs b/MediaBrowser.Server.Startup.Common/Migrations/Release5767.cs new file mode 100644 index 0000000000..9a4580c127 --- /dev/null +++ b/MediaBrowser.Server.Startup.Common/Migrations/Release5767.cs @@ -0,0 +1,47 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Server.Implementations.LiveTv; +using MediaBrowser.Server.Implementations.Persistence; +using MediaBrowser.Server.Implementations.ScheduledTasks; + +namespace MediaBrowser.Server.Startup.Common.Migrations +{ + public class Release5767 : IVersionMigration + { + private readonly IServerConfigurationManager _config; + private readonly ITaskManager _taskManager; + + public Release5767(IServerConfigurationManager config, ITaskManager taskManager) + { + _config = config; + _taskManager = taskManager; + } + + public void Run() + { + var name = "5767"; + + if (_config.Configuration.Migrations.Contains(name, StringComparer.OrdinalIgnoreCase)) + { + return; + } + + Task.Run(async () => + { + await Task.Delay(3000).ConfigureAwait(false); + + _taskManager.QueueScheduledTask<RefreshChannelsScheduledTask>(); + _taskManager.QueueScheduledTask<CleanDatabaseScheduledTask>(); + _taskManager.QueueScheduledTask<RefreshMediaLibraryTask>(); + }); + + var list = _config.Configuration.Migrations.ToList(); + list.Add(name); + _config.Configuration.Migrations = list.ToArray(); + _config.SaveConfiguration(); + } + } +} |
