From 0f8b3c634708ce8e7b2e2ae6fed87b6b943b5bca Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Thu, 13 Dec 2018 14:18:25 +0100 Subject: Use Microsoft.Extensions.Logging abstraction --- Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs') diff --git a/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs index 0c9eb0f1b..4cb97cbda 100644 --- a/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs +++ b/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs @@ -1,6 +1,6 @@ using MediaBrowser.Common; using MediaBrowser.Common.Configuration; -using MediaBrowser.Model.Logging; +using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Threading; @@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.ScheduledTasks if (!updateInfo.IsUpdateAvailable) { - Logger.Debug("No application update available."); + Logger.LogDebug("No application update available."); return; } @@ -83,13 +83,13 @@ namespace Emby.Server.Implementations.ScheduledTasks if (ConfigurationManager.CommonConfiguration.EnableAutoUpdate) { - Logger.Info("Update Revision {0} available. Updating...", updateInfo.AvailableVersion); + Logger.LogInformation("Update Revision {0} available. Updating...", updateInfo.AvailableVersion); await _appHost.UpdateApplication(updateInfo.Package, cancellationToken, progress).ConfigureAwait(false); } else { - Logger.Info("A new version of " + _appHost.Name + " is available."); + Logger.LogInformation("A new version of " + _appHost.Name + " is available."); } } -- cgit v1.2.3 From 7679ed037f4bfa31762fc1ff40cec8297105d658 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Wed, 2 Jan 2019 17:54:26 +0100 Subject: Disable SystemUpdateTask --- Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs') diff --git a/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs index 4cb97cbda..890a20ddf 100644 --- a/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs +++ b/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs @@ -13,7 +13,7 @@ namespace Emby.Server.Implementations.ScheduledTasks /// /// Plugin Update Task /// - public class SystemUpdateTask : IScheduledTask + public class SystemUpdateTask /*: IScheduledTask*/ { /// /// The _app host -- cgit v1.2.3 From 3fa751e9bbef072c5bb4c39aad1aede8ced1c003 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Wed, 2 Jan 2019 18:10:52 +0100 Subject: Remove CheckForApplicationUpdate function --- Emby.Server.Implementations/ApplicationHost.cs | 11 ----------- .../ScheduledTasks/PluginUpdateTask.cs | 5 +++-- .../ScheduledTasks/SystemUpdateTask.cs | 5 +++-- MediaBrowser.Common/IApplicationHost.cs | 6 ------ 4 files changed, 6 insertions(+), 21 deletions(-) (limited to 'Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs') diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 98c7cf38b..fe615fab0 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -2283,17 +2283,6 @@ namespace Emby.Server.Implementations Plugins = list.ToArray(); } - /// - /// Checks for update. - /// - /// The cancellation token. - /// The progress. - /// Task{CheckForUpdateResult}. - public Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress) - { - throw new Exception("Unimplemented"); - } - /// /// Updates the application. /// diff --git a/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs index 9b3571ac2..8c562e452 100644 --- a/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs +++ b/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Common; +/*using MediaBrowser.Common; using MediaBrowser.Common.Updates; using Microsoft.Extensions.Logging; using MediaBrowser.Model.Net; @@ -16,7 +16,7 @@ namespace Emby.Server.Implementations.ScheduledTasks /// /// Plugin Update Task /// - public class PluginUpdateTask /*: IScheduledTask, IConfigurableScheduledTask*/ + public class PluginUpdateTask : IScheduledTask, IConfigurableScheduledTask { /// /// The _logger @@ -140,3 +140,4 @@ namespace Emby.Server.Implementations.ScheduledTasks public bool IsLogged => true; } } +*/ diff --git a/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs index 890a20ddf..18ff33e95 100644 --- a/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs +++ b/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Common; +/*using MediaBrowser.Common; using MediaBrowser.Common.Configuration; using Microsoft.Extensions.Logging; using System; @@ -13,7 +13,7 @@ namespace Emby.Server.Implementations.ScheduledTasks /// /// Plugin Update Task /// - public class SystemUpdateTask /*: IScheduledTask*/ + public class SystemUpdateTask : IScheduledTask { /// /// The _app host @@ -126,3 +126,4 @@ namespace Emby.Server.Implementations.ScheduledTasks } } } +*/ diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index 32b942b60..39d69ea15 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -85,12 +85,6 @@ namespace MediaBrowser.Common /// IEnumerable{``0}. IEnumerable GetExports(bool manageLiftime = true); - /// - /// Checks for update. - /// - /// Task{CheckForUpdateResult}. - Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress); - /// /// Updates the application. /// -- cgit v1.2.3 From 1fb975c6e766ba40a637d0c9996c1d309b05e8fb Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Wed, 2 Jan 2019 18:44:06 +0100 Subject: Delete SystemUpdateTask.cs --- .../ScheduledTasks/SystemUpdateTask.cs | 129 --------------------- 1 file changed, 129 deletions(-) delete mode 100644 Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs (limited to 'Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs') diff --git a/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs deleted file mode 100644 index 18ff33e95..000000000 --- a/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs +++ /dev/null @@ -1,129 +0,0 @@ -/*using MediaBrowser.Common; -using MediaBrowser.Common.Configuration; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Common.Progress; -using MediaBrowser.Model.Tasks; - -namespace Emby.Server.Implementations.ScheduledTasks -{ - /// - /// Plugin Update Task - /// - public class SystemUpdateTask : IScheduledTask - { - /// - /// The _app host - /// - private readonly IApplicationHost _appHost; - - /// - /// Gets or sets the configuration manager. - /// - /// The configuration manager. - private IConfigurationManager ConfigurationManager { get; set; } - /// - /// Gets or sets the logger. - /// - /// The logger. - private ILogger Logger { get; set; } - - /// - /// Initializes a new instance of the class. - /// - /// The app host. - /// The configuration manager. - /// The logger. - public SystemUpdateTask(IApplicationHost appHost, IConfigurationManager configurationManager, ILogger logger) - { - _appHost = appHost; - ConfigurationManager = configurationManager; - Logger = logger; - } - - /// - /// Creates the triggers that define when the task will run - /// - /// IEnumerable{BaseTaskTrigger}. - public IEnumerable GetDefaultTriggers() - { - return new[] { - - // At startup - new TaskTriggerInfo {Type = TaskTriggerInfo.TriggerStartup}, - - // Every so often - new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks} - }; - } - - /// - /// Returns the task to be executed - /// - /// The cancellation token. - /// The progress. - /// Task. - public async Task Execute(CancellationToken cancellationToken, IProgress progress) - { - // Create a progress object for the update check - var updateInfo = await _appHost.CheckForApplicationUpdate(cancellationToken, new SimpleProgress()).ConfigureAwait(false); - - if (!updateInfo.IsUpdateAvailable) - { - Logger.LogDebug("No application update available."); - return; - } - - cancellationToken.ThrowIfCancellationRequested(); - - if (!_appHost.CanSelfUpdate) return; - - if (ConfigurationManager.CommonConfiguration.EnableAutoUpdate) - { - Logger.LogInformation("Update Revision {0} available. Updating...", updateInfo.AvailableVersion); - - await _appHost.UpdateApplication(updateInfo.Package, cancellationToken, progress).ConfigureAwait(false); - } - else - { - Logger.LogInformation("A new version of " + _appHost.Name + " is available."); - } - } - - /// - /// Gets the name of the task - /// - /// The name. - public string Name - { - get { return "Check for application updates"; } - } - - /// - /// Gets the description. - /// - /// The description. - public string Description - { - get { return "Downloads and installs application updates."; } - } - - /// - /// Gets the category. - /// - /// The category. - public string Category - { - get { return "Application"; } - } - - public string Key - { - get { return "SystemUpdateTask"; } - } - } -} -*/ -- cgit v1.2.3