From 819422acc8d3eaf6d7de6c21bca5039ca0c44f52 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Thu, 7 Aug 2025 10:57:29 +0200 Subject: [PATCH] add `enable` param to installPlugin function --- app/Facades/Plugins.php | 2 +- app/Services/Helpers/PluginService.php | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/Facades/Plugins.php b/app/Facades/Plugins.php index 6d76d69bc..ce76d9124 100644 --- a/app/Facades/Plugins.php +++ b/app/Facades/Plugins.php @@ -13,7 +13,7 @@ use Filament\Panel; * @method static void loadPanelPlugins(Panel $panel) * @method static void requireComposerPackages(Plugin $plugin) * @method static void runPluginMigrations(Plugin $plugin) - * @method static void installPlugin(Plugin $plugin) + * @method static void installPlugin(Plugin $plugin, bool $enable = true) * @method static void updatePlugin(Plugin $plugin) * @method static void downloadPluginFromFile(UploadedFile $file) * @method static void downloadPluginFromUrl(string $url) diff --git a/app/Services/Helpers/PluginService.php b/app/Services/Helpers/PluginService.php index c69a551f8..e39dd4b1b 100644 --- a/app/Services/Helpers/PluginService.php +++ b/app/Services/Helpers/PluginService.php @@ -187,7 +187,7 @@ class PluginService return false; } - public function installPlugin(Plugin $plugin): void + public function installPlugin(Plugin $plugin, bool $enable = true): void { try { $this->requireComposerPackages($plugin); @@ -196,7 +196,9 @@ class PluginService $this->buildAssets(); - $this->enablePlugin($plugin); + if ($enable) { + $this->enablePlugin($plugin); + } } catch (Exception $exception) { report($exception); @@ -209,11 +211,7 @@ class PluginService try { $this->downloadPluginFromUrl($plugin->getDownloadUrlForUpdate(), true); - $this->requireComposerPackages($plugin); - - $this->runPluginMigrations($plugin); - - $this->buildAssets(); + $this->installPlugin($plugin, false); cache()->forget("plugins.$plugin->id.update"); } catch (Exception $exception) {