mirror of
https://github.com/pelican-dev/panel.git
synced 2025-11-09 20:19:26 +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;
|
return '\\' . $this->namespace . '\\' . $this->class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldLoad(): bool
|
public function shouldLoad(?string $panelId = null): bool
|
||||||
{
|
{
|
||||||
return !$this->isDisabled() && $this->isInstalled() && !$this->isIncompatible();
|
return !$this->isDisabled() && $this->isInstalled() && !$this->isIncompatible() && (is_null($panelId) || !$this->panels || in_array($panelId, explode(',', $this->panels)));
|
||||||
}
|
|
||||||
|
|
||||||
public function shouldLoadPanel(string $panelId): bool
|
|
||||||
{
|
|
||||||
return !$this->isDisabled() && $this->isInstalled() && !$this->isIncompatible() && (!$this->panels || in_array($panelId, explode(',', $this->panels)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canEnable(): bool
|
public function canEnable(): bool
|
||||||
|
|||||||
@ -134,7 +134,7 @@ class PluginService
|
|||||||
$plugins = Plugin::query()->orderBy('load_order')->get();
|
$plugins = Plugin::query()->orderBy('load_order')->get();
|
||||||
foreach ($plugins as $plugin) {
|
foreach ($plugins as $plugin) {
|
||||||
try {
|
try {
|
||||||
if (!$plugin->shouldLoadPanel($panel->getId())) {
|
if (!$plugin->shouldLoad($panel->getId())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,9 @@ class PluginService
|
|||||||
|
|
||||||
$panel->plugin(new $pluginClass());
|
$panel->plugin(new $pluginClass());
|
||||||
|
|
||||||
|
if ($plugin->hasErrored()) {
|
||||||
$this->enablePlugin($plugin);
|
$this->enablePlugin($plugin);
|
||||||
|
}
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
if ($this->isDevModeActive()) {
|
if ($this->isDevModeActive()) {
|
||||||
throw ($exception);
|
throw ($exception);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user