mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-05 21:33:02 +02:00
Change PluginStatus states.
This commit is contained in:
parent
212c76102d
commit
a4a40407a0
|
@ -77,7 +77,7 @@ namespace Emby.Server.Implementations
|
||||||
for (int a = _plugins.Count - 1; a >= 0; a--)
|
for (int a = _plugins.Count - 1; a >= 0; a--)
|
||||||
{
|
{
|
||||||
var plugin = _plugins[a];
|
var plugin = _plugins[a];
|
||||||
if (plugin.Manifest.Status == PluginStatus.DeleteOnStartup && DeletePlugin(plugin))
|
if (plugin.Manifest.Status == PluginStatus.Deleted && DeletePlugin(plugin))
|
||||||
{
|
{
|
||||||
UpdateSuccessors(plugin);
|
UpdateSuccessors(plugin);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ namespace Emby.Server.Implementations
|
||||||
catch (FileLoadException ex)
|
catch (FileLoadException ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Failed to load assembly {Path}. Disabling plugin.", file);
|
_logger.LogError(ex, "Failed to load assembly {Path}. Disabling plugin.", file);
|
||||||
ChangePluginState(plugin, PluginStatus.Malfunction);
|
ChangePluginState(plugin, PluginStatus.Malfunctioned);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ namespace Emby.Server.Implementations
|
||||||
#pragma warning restore CA1031 // Do not catch general exception types
|
#pragma warning restore CA1031 // Do not catch general exception types
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error registering plugin services from {Assembly}.", pluginServiceRegistrator.Assembly.FullName);
|
_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);
|
_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);
|
_logger.LogWarning("Unable to delete {Path}, so marking as deleteOnStartup.", plugin.Path);
|
||||||
// Unable to delete, so disable.
|
// Unable to delete, so disable.
|
||||||
return ChangePluginState(plugin, PluginStatus.DeleteOnStartup);
|
return ChangePluginState(plugin, PluginStatus.Deleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -307,7 +307,7 @@ namespace Emby.Server.Implementations
|
||||||
private void UpdateSuccessors(LocalPlugin plugin)
|
private void UpdateSuccessors(LocalPlugin plugin)
|
||||||
{
|
{
|
||||||
// This value is memory only - so that the web will show restart required.
|
// 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.
|
// Detect whether there is another version of this plugin that needs disabling.
|
||||||
var predecessor = _plugins.OrderByDescending(p => p.Version)
|
var predecessor = _plugins.OrderByDescending(p => p.Version)
|
||||||
|
@ -349,7 +349,7 @@ namespace Emby.Server.Implementations
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangePluginState(plugin, PluginStatus.Malfunction);
|
ChangePluginState(plugin, PluginStatus.Malfunctioned);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -486,7 +486,7 @@ namespace Emby.Server.Implementations
|
||||||
_logger.LogError(ex, "Error creating {Type}", type.FullName);
|
_logger.LogError(ex, "Error creating {Type}", type.FullName);
|
||||||
if (plugin != null)
|
if (plugin != null)
|
||||||
{
|
{
|
||||||
if (ChangePluginState(plugin, PluginStatus.Malfunction))
|
if (ChangePluginState(plugin, PluginStatus.Malfunctioned))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Plugin {Path} has been disabled.", plugin.Path);
|
_logger.LogInformation("Plugin {Path} has been disabled.", plugin.Path);
|
||||||
return null;
|
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.
|
// Auto-create a plugin manifest, so we can disable it, if it fails to load.
|
||||||
manifest = new PluginManifest
|
manifest = new PluginManifest
|
||||||
{
|
{
|
||||||
Status = PluginStatus.RestartRequired,
|
Status = PluginStatus.Restart,
|
||||||
Name = metafile,
|
Name = metafile,
|
||||||
AutoUpdate = false,
|
AutoUpdate = false,
|
||||||
Guid = metafile.GetMD5(),
|
Guid = metafile.GetMD5(),
|
||||||
|
@ -697,9 +697,9 @@ namespace Emby.Server.Implementations
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (manifest.Status != PluginStatus.DeleteOnStartup)
|
if (manifest.Status != PluginStatus.Deleted)
|
||||||
{
|
{
|
||||||
manifest.Status = PluginStatus.DeleteOnStartup;
|
manifest.Status = PluginStatus.Deleted;
|
||||||
SaveManifest(manifest, entry.Path);
|
SaveManifest(manifest, entry.Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@ namespace MediaBrowser.Model.Plugins
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This plugin requires a restart in order for it to load. This is a memory only status.
|
/// 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.
|
/// 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.
|
/// but a disk manifest status of Disabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RestartRequired = 1,
|
Restart = 1,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This plugin is currently running.
|
/// This plugin is currently running.
|
||||||
|
@ -31,7 +31,7 @@ namespace MediaBrowser.Model.Plugins
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This plugin caused an error when instantiated. (Either DI loop, or exception)
|
/// This plugin caused an error when instantiated. (Either DI loop, or exception)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Malfunction = -3,
|
Malfunctioned = -3,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This plugin has been superceded by another version.
|
/// 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.
|
/// An attempt to remove this plugin from disk will happen at every restart.
|
||||||
/// It will not be loaded, if unable to do so.
|
/// It will not be loaded, if unable to do so.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DeleteOnStartup = -5
|
Deleted = -5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue