fix: don't throw when enabling an already enabled plugin (needed for orphans)

This commit is contained in:
goat 2023-01-09 00:20:38 +01:00
parent e225f4df0e
commit 2849613d79
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -570,8 +570,11 @@ internal class LocalPlugin : IDisposable
throw new ArgumentOutOfRangeException(this.State.ToString()); throw new ArgumentOutOfRangeException(this.State.ToString());
} }
if (!this.Manifest.Disabled) // NOTE(goat): This is inconsequential, and we do have situations where a plugin can end up enabled but not loaded:
throw new InvalidPluginOperationException($"Unable to enable {this.Name}, not disabled"); // Orphaned plugins can have their repo added back, but may not have been loaded at boot and may still be enabled.
// We don't want to disable orphaned plugins when they are orphaned so this is how it's going to be.
// if (!this.Manifest.Disabled)
// throw new InvalidPluginOperationException($"Unable to enable {this.Name}, not disabled");
this.Manifest.Disabled = false; this.Manifest.Disabled = false;
this.Manifest.ScheduledForDeletion = false; this.Manifest.ScheduledForDeletion = false;