diff --git a/app/Models/Plugin.php b/app/Models/Plugin.php index ed4cea9b7..534523aa3 100644 --- a/app/Models/Plugin.php +++ b/app/Models/Plugin.php @@ -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 diff --git a/app/Services/Helpers/PluginService.php b/app/Services/Helpers/PluginService.php index 9dac1fcd7..c5f4ca44c 100644 --- a/app/Services/Helpers/PluginService.php +++ b/app/Services/Helpers/PluginService.php @@ -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);