mirror of
https://github.com/pelican-dev/panel.git
synced 2025-11-08 10:39:27 +01:00
only enable plugin if it previously errored
This commit is contained in:
parent
b5736e89f4
commit
55677472be
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user