only enable plugin if it previously errored

This commit is contained in:
Boy132 2025-11-06 09:11:57 +01:00
parent b5736e89f4
commit 55677472be
2 changed files with 6 additions and 9 deletions

View File

@ -190,14 +190,9 @@ class Plugin extends Model implements HasPluginSettings
return '\\' . $this->namespace . '\\' . $this->class;
}
public function shouldLoad(): bool
public function shouldLoad(?string $panelId = null): bool
{
return !$this->isDisabled() && $this->isInstalled() && !$this->isIncompatible();
}
public function shouldLoadPanel(string $panelId): bool
{
return !$this->isDisabled() && $this->isInstalled() && !$this->isIncompatible() && (!$this->panels || in_array($panelId, explode(',', $this->panels)));
return !$this->isDisabled() && $this->isInstalled() && !$this->isIncompatible() && (is_null($panelId) || !$this->panels || in_array($panelId, explode(',', $this->panels)));
}
public function canEnable(): bool

View File

@ -134,7 +134,7 @@ class PluginService
$plugins = Plugin::query()->orderBy('load_order')->get();
foreach ($plugins as $plugin) {
try {
if (!$plugin->shouldLoadPanel($panel->getId())) {
if (!$plugin->shouldLoad($panel->getId())) {
continue;
}
@ -146,7 +146,9 @@ class PluginService
$panel->plugin(new $pluginClass());
$this->enablePlugin($plugin);
if ($plugin->hasErrored()) {
$this->enablePlugin($plugin);
}
} catch (Exception $exception) {
if ($this->isDevModeActive()) {
throw ($exception);