diff --git a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs index 949dac926..d2da2ee84 100644 --- a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs +++ b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs @@ -6,6 +6,7 @@ using ServiceStack; using System; using System.Collections.Generic; using System.Linq; +using MediaBrowser.Controller.Configuration; namespace MediaBrowser.Api.ScheduledTasks { @@ -90,12 +91,14 @@ namespace MediaBrowser.Api.ScheduledTasks /// The task manager. private ITaskManager TaskManager { get; set; } + private readonly IServerConfigurationManager _config; + /// /// Initializes a new instance of the class. /// /// The task manager. - /// taskManager - public ScheduledTaskService(ITaskManager taskManager) + /// taskManager + public ScheduledTaskService(ITaskManager taskManager, IServerConfigurationManager config) { if (taskManager == null) { @@ -103,6 +106,7 @@ namespace MediaBrowser.Api.ScheduledTasks } TaskManager = taskManager; + _config = config; } /// @@ -194,6 +198,20 @@ namespace MediaBrowser.Api.ScheduledTasks throw new ResourceNotFoundException("Task not found"); } + var hasKey = task.ScheduledTask as IHasKey; + if (hasKey != null) + { + if (string.Equals(hasKey.Key, "SystemUpdateTask", StringComparison.OrdinalIgnoreCase)) + { + // This is a hack for now just to get the update application function to work when auto-update is disabled + if (!_config.Configuration.EnableAutoUpdate) + { + _config.Configuration.EnableAutoUpdate = true; + _config.SaveConfiguration(); + } + } + } + TaskManager.Execute(task); }