From f516053899b4e6645daa1226e51469a53534c596 Mon Sep 17 00:00:00 2001 From: Timothee Date: Fri, 27 Feb 2026 16:18:47 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B09088=20Allow=20extension=20uninstallatio?= =?UTF-8?q?n=20from=20production-modules=20folder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/extensionsmap.class.inc.php | 12 ++++++------ setup/wizardsteps/WizStepModulesChoice.php | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/setup/extensionsmap.class.inc.php b/setup/extensionsmap.class.inc.php index 89d169499b..64afd0669a 100644 --- a/setup/extensionsmap.class.inc.php +++ b/setup/extensionsmap.class.inc.php @@ -375,14 +375,14 @@ class iTopExtensionsMap * @return array<\iTopExtension>> */ - public function GetAllExtensionsToDisplayInSetup(bool $bKeepMissingDependencyExtensions = false): array + public function GetAllExtensionsToDisplayInSetup(bool $bKeepMissingDependencyExtensions = false, bool $bMandatoryRemoteExtension = true): array { $aRes = []; foreach ($this->GetAllExtensionsWithPreviouslyInstalled() as $oExtension) { /** @var \iTopExtension $oExtension */ - if (($oExtension->sSource !== iTopExtension::SOURCE_WIZARD) && ($oExtension->bVisible)) { - if ($bKeepMissingDependencyExtensions || (count($oExtension->aMissingDependencies) == 0)) { - if (!$oExtension->bMandatory) { + if ($oExtension->sSource !== iTopExtension::SOURCE_WIZARD && $oExtension->bVisible) { + if ($bKeepMissingDependencyExtensions || count($oExtension->aMissingDependencies) == 0) { + if (!$oExtension->bMandatory && $bMandatoryRemoteExtension) { $oExtension->bMandatory = ($oExtension->sSource === iTopExtension::SOURCE_REMOTE); } $aRes[$oExtension->sCode] = $oExtension; @@ -393,10 +393,10 @@ class iTopExtensionsMap return $aRes; } - public function GetAllExtensionsOptionInfo(): array + public function GetAllExtensionsOptionInfo(bool $bMandatoryRemoteExtension = true): array { $aRes = []; - foreach ($this->GetAllExtensionsToDisplayInSetup() as $sCode => $oExtension) { + foreach ($this->GetAllExtensionsToDisplayInSetup(false, $bMandatoryRemoteExtension) as $sCode => $oExtension) { $aRes[] = [ 'extension_code' => $oExtension->sCode, 'title' => $oExtension->sLabel, diff --git a/setup/wizardsteps/WizStepModulesChoice.php b/setup/wizardsteps/WizStepModulesChoice.php index 5cb90bd019..372e0786b5 100644 --- a/setup/wizardsteps/WizStepModulesChoice.php +++ b/setup/wizardsteps/WizStepModulesChoice.php @@ -626,7 +626,7 @@ EOF protected function GetStepInfo($idx = null) { $index = $idx ?? $this->GetStepIndex(); - + $bMandatoryRemoteExtension = !$this->oWizard->GetParameter('force-uninstall', false); if (is_null($this->aSteps)) { $this->oWizard->SetParameter('additional_extensions_modules', json_encode([])); // Default value, no additional extensions @@ -637,7 +637,7 @@ EOF if ($index + 1 >= count($this->aSteps)) { //make sure we also cache next step as well - $aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo(); + $aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo($bMandatoryRemoteExtension); // Display this step of the wizard only if there is something to display if (count($aOptions) > 0) { @@ -651,7 +651,7 @@ EOF } } } else { - $aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo(); + $aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo($bMandatoryRemoteExtension); // No wizard configuration provided, build a standard one with just one big list. All items are mandatory, only works when there are no conflicted modules. $this->aSteps = [