From a4a40407a047de2f10aa0f9d0ba9fe0f600ffdb0 Mon Sep 17 00:00:00 2001 From: Greenback Date: Thu, 17 Dec 2020 13:44:38 +0000 Subject: [PATCH] Change PluginStatus states. --- .../Plugins/PluginManager.cs | 20 +++++++++---------- MediaBrowser.Model/Plugins/PluginStatus.cs | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Emby.Server.Implementations/Plugins/PluginManager.cs b/Emby.Server.Implementations/Plugins/PluginManager.cs index e7589a0f9..975b70843 100644 --- a/Emby.Server.Implementations/Plugins/PluginManager.cs +++ b/Emby.Server.Implementations/Plugins/PluginManager.cs @@ -77,7 +77,7 @@ namespace Emby.Server.Implementations for (int a = _plugins.Count - 1; a >= 0; a--) { var plugin = _plugins[a]; - if (plugin.Manifest.Status == PluginStatus.DeleteOnStartup && DeletePlugin(plugin)) + if (plugin.Manifest.Status == PluginStatus.Deleted && DeletePlugin(plugin)) { UpdateSuccessors(plugin); } @@ -104,7 +104,7 @@ namespace Emby.Server.Implementations catch (FileLoadException ex) { _logger.LogError(ex, "Failed to load assembly {Path}. Disabling plugin.", file); - ChangePluginState(plugin, PluginStatus.Malfunction); + ChangePluginState(plugin, PluginStatus.Malfunctioned); continue; } @@ -156,7 +156,7 @@ namespace Emby.Server.Implementations #pragma warning restore CA1031 // Do not catch general exception types { _logger.LogError(ex, "Error registering plugin services from {Assembly}.", pluginServiceRegistrator.Assembly.FullName); - if (ChangePluginState(plugin, PluginStatus.Malfunction)) + if (ChangePluginState(plugin, PluginStatus.Malfunctioned)) { _logger.LogInformation("Disabling plugin {Path}", plugin.Path); } @@ -206,7 +206,7 @@ namespace Emby.Server.Implementations _logger.LogWarning("Unable to delete {Path}, so marking as deleteOnStartup.", plugin.Path); // Unable to delete, so disable. - return ChangePluginState(plugin, PluginStatus.DeleteOnStartup); + return ChangePluginState(plugin, PluginStatus.Deleted); } /// @@ -307,7 +307,7 @@ namespace Emby.Server.Implementations private void UpdateSuccessors(LocalPlugin plugin) { // This value is memory only - so that the web will show restart required. - plugin.Manifest.Status = PluginStatus.RestartRequired; + plugin.Manifest.Status = PluginStatus.Restart; // Detect whether there is another version of this plugin that needs disabling. var predecessor = _plugins.OrderByDescending(p => p.Version) @@ -349,7 +349,7 @@ namespace Emby.Server.Implementations return; } - ChangePluginState(plugin, PluginStatus.Malfunction); + ChangePluginState(plugin, PluginStatus.Malfunctioned); } /// @@ -486,7 +486,7 @@ namespace Emby.Server.Implementations _logger.LogError(ex, "Error creating {Type}", type.FullName); if (plugin != null) { - if (ChangePluginState(plugin, PluginStatus.Malfunction)) + if (ChangePluginState(plugin, PluginStatus.Malfunctioned)) { _logger.LogInformation("Plugin {Path} has been disabled.", plugin.Path); return null; @@ -600,7 +600,7 @@ namespace Emby.Server.Implementations // Auto-create a plugin manifest, so we can disable it, if it fails to load. manifest = new PluginManifest { - Status = PluginStatus.RestartRequired, + Status = PluginStatus.Restart, Name = metafile, AutoUpdate = false, Guid = metafile.GetMD5(), @@ -697,9 +697,9 @@ namespace Emby.Server.Implementations continue; } - if (manifest.Status != PluginStatus.DeleteOnStartup) + if (manifest.Status != PluginStatus.Deleted) { - manifest.Status = PluginStatus.DeleteOnStartup; + manifest.Status = PluginStatus.Deleted; SaveManifest(manifest, entry.Path); } } diff --git a/MediaBrowser.Model/Plugins/PluginStatus.cs b/MediaBrowser.Model/Plugins/PluginStatus.cs index 2acc56811..3ea05174f 100644 --- a/MediaBrowser.Model/Plugins/PluginStatus.cs +++ b/MediaBrowser.Model/Plugins/PluginStatus.cs @@ -8,10 +8,10 @@ namespace MediaBrowser.Model.Plugins /// /// This plugin requires a restart in order for it to load. This is a memory only status. /// The actual status of the plugin after reload is present in the manifest. - /// eg. A disabled plugin will still be active until the next restart, and so will have a memory status of RestartRequired, + /// eg. A disabled plugin will still be active until the next restart, and so will have a memory status of Restart, /// but a disk manifest status of Disabled. /// - RestartRequired = 1, + Restart = 1, /// /// This plugin is currently running. @@ -31,7 +31,7 @@ namespace MediaBrowser.Model.Plugins /// /// This plugin caused an error when instantiated. (Either DI loop, or exception) /// - Malfunction = -3, + Malfunctioned = -3, /// /// This plugin has been superceded by another version. @@ -42,6 +42,6 @@ namespace MediaBrowser.Model.Plugins /// An attempt to remove this plugin from disk will happen at every restart. /// It will not be loaded, if unable to do so. /// - DeleteOnStartup = -5 + Deleted = -5 } }