add enable param to installPlugin function

This commit is contained in:
Boy132 2025-08-07 10:57:29 +02:00
parent 85f8f11481
commit 819422acc8
2 changed files with 6 additions and 8 deletions

View File

@ -13,7 +13,7 @@ use Filament\Panel;
* @method static void loadPanelPlugins(Panel $panel) * @method static void loadPanelPlugins(Panel $panel)
* @method static void requireComposerPackages(Plugin $plugin) * @method static void requireComposerPackages(Plugin $plugin)
* @method static void runPluginMigrations(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 updatePlugin(Plugin $plugin)
* @method static void downloadPluginFromFile(UploadedFile $file) * @method static void downloadPluginFromFile(UploadedFile $file)
* @method static void downloadPluginFromUrl(string $url) * @method static void downloadPluginFromUrl(string $url)

View File

@ -187,7 +187,7 @@ class PluginService
return false; return false;
} }
public function installPlugin(Plugin $plugin): void public function installPlugin(Plugin $plugin, bool $enable = true): void
{ {
try { try {
$this->requireComposerPackages($plugin); $this->requireComposerPackages($plugin);
@ -196,7 +196,9 @@ class PluginService
$this->buildAssets(); $this->buildAssets();
$this->enablePlugin($plugin); if ($enable) {
$this->enablePlugin($plugin);
}
} catch (Exception $exception) { } catch (Exception $exception) {
report($exception); report($exception);
@ -209,11 +211,7 @@ class PluginService
try { try {
$this->downloadPluginFromUrl($plugin->getDownloadUrlForUpdate(), true); $this->downloadPluginFromUrl($plugin->getDownloadUrlForUpdate(), true);
$this->requireComposerPackages($plugin); $this->installPlugin($plugin, false);
$this->runPluginMigrations($plugin);
$this->buildAssets();
cache()->forget("plugins.$plugin->id.update"); cache()->forget("plugins.$plugin->id.update");
} catch (Exception $exception) { } catch (Exception $exception) {