From 9fbdbcb05493a88bfa59fab2669c697996cabeb4 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 12 Jan 2025 20:38:55 +0000 Subject: [PATCH 1/2] Fix list enabled/disabled addons --- src/Console/Addon.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/Console/Addon.php b/src/Console/Addon.php index 8066853246..1623ab13f0 100644 --- a/src/Console/Addon.php +++ b/src/Console/Addon.php @@ -121,27 +121,28 @@ HELP; $this->out($this->getHelp()); return false; } + foreach (AddonCore::getAvailableList() as $addon) { $addon_name = $addon[0]; - $enabled = AddonCore::isEnabled($addon_name) ? "enabled" : "disabled"; - switch ($subCmd) { - case 'all': - $table->addRow([$addon_name, $enabled]); - break; - case 'enabled': - if (!$enabled) { - continue 2; - } - $table->addRow([$addon_name]); - case 'disabled': - if ($enabled) { - continue 2; - } - $table->addRow([$addon_name]); - break; + $enabled = AddonCore::isEnabled($addon_name); + + if ($subCmd === 'all') { + $table->addRow([$addon_name, $enabled ? 'enabled' : 'disabled']); + + continue; } + if ($subCmd === 'enabled' && $enabled === true) { + $table->addRow([$addon_name]); + continue; + } + + if ($subCmd === 'disabled' && $enabled === false) { + $table->addRow([$addon_name]); + continue; + } } + $this->out($table->getTable()); return 0; From 7b241cebeb14d22e1fc142e7c83410cb2dbdaec0 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 12 Jan 2025 20:48:53 +0000 Subject: [PATCH 2/2] Fix code style --- src/Console/Addon.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Console/Addon.php b/src/Console/Addon.php index 1623ab13f0..e4bdeb052b 100644 --- a/src/Console/Addon.php +++ b/src/Console/Addon.php @@ -60,9 +60,9 @@ HELP; { parent::__construct($argv); - $this->appMode = $appMode; - $this->l10n = $l10n; - $this->dba = $dba; + $this->appMode = $appMode; + $this->l10n = $l10n; + $this->dba = $dba; AddonCore::loadAddons(); } @@ -124,7 +124,7 @@ HELP; foreach (AddonCore::getAvailableList() as $addon) { $addon_name = $addon[0]; - $enabled = AddonCore::isEnabled($addon_name); + $enabled = AddonCore::isEnabled($addon_name); if ($subCmd === 'all') { $table->addRow([$addon_name, $enabled ? 'enabled' : 'disabled']);