From cfcad3b39a4e646a569acf5a6e6fe830a28825ba Mon Sep 17 00:00:00 2001 From: "lenaick.moreira" Date: Wed, 5 Aug 2026 17:37:29 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B09861=20-=20Changes=20from=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/wizardcontroller.class.inc.php | 19 ++++++++++++++++++- .../wizardsteps/WizStepLandingBeforeAudit.php | 16 ++++++---------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/setup/wizardcontroller.class.inc.php b/setup/wizardcontroller.class.inc.php index 5511c8685..6b6b9b503 100644 --- a/setup/wizardcontroller.class.inc.php +++ b/setup/wizardcontroller.class.inc.php @@ -59,7 +59,7 @@ class WizardController * Removes information about the previous step from the stack * @return array{'class': string, 'state': string} */ - protected function PopStep(): array + public function PopStep(): array { $aStep = array_pop($this->aWizardSteps); $this->SetParameter('_steps', $this->aWizardSteps); @@ -335,4 +335,21 @@ EOF { $this->oSessionParameters->Erase(); } + + /** + * @param string $sStepClass The class name of the step to find the latest state for + * + * @return WizardState + */ + public function GetLatestWizardStateFromStepClass(string $sStepClass, bool $bPopStep = true): WizardState + { + $iCountModulesChoiceSteps = count(array_filter($this->aWizardSteps, fn (array $step): bool => $step['class'] === $sStepClass && $step['state'] !== '')); + $sStepState = $iCountModulesChoiceSteps > 0 ? (string) ($iCountModulesChoiceSteps - 1) : ''; + + if ($bPopStep) { + $this->PopStep(); + } + + return new WizardState($sStepClass, $sStepState); + } } diff --git a/setup/wizardsteps/WizStepLandingBeforeAudit.php b/setup/wizardsteps/WizStepLandingBeforeAudit.php index 0c7cb6562..a46852127 100644 --- a/setup/wizardsteps/WizStepLandingBeforeAudit.php +++ b/setup/wizardsteps/WizStepLandingBeforeAudit.php @@ -69,6 +69,7 @@ class WizStepLandingBeforeAudit extends WizStepModulesChoice $aWizardSteps = $this->GetWizardSteps(); if ($bSkipWizard) { $this->oWizard->SetParameter('_steps', $aWizardSteps); + $this->oWizard->SetWizardSteps($aWizardSteps); } // Component selection in previous screens @@ -80,19 +81,14 @@ class WizStepLandingBeforeAudit extends WizStepModulesChoice $aSelectedComponents = json_decode($this->oWizard->GetParameter('selected_components'), true); } - $bDisableUninstallCheck = (bool)$this->oWizard->GetParameter('force-uninstall', false); - $bRemoteExtensionsShouldBeMandatory = !$bDisableUninstallCheck; - $aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo($bRemoteExtensionsShouldBeMandatory); + $bForceUninstall = (bool)$this->oWizard->GetParameter('force-uninstall', false); + $aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo(bRemoteExtensionsShouldBeMandatory: !$bForceUninstall); foreach ($aOptions as $index => $aChoice) { $sChoiceId = self::$SEP.$index; - $aFlags = $this->ComputeChoiceFlags($aChoice, $sChoiceId, $aSelectedComponents, false, $bDisableUninstallCheck, true); - if (!$this->CanMoveForwardFromChoiceFlags($aFlags, $bDisableUninstallCheck)) { + $aFlags = $this->ComputeChoiceFlags($aChoice, $sChoiceId, $aSelectedComponents, false, $bForceUninstall, true); + if (!$this->CanMoveForwardFromChoiceFlags($aFlags, $bForceUninstall)) { // If the user has selected incompatible modules, we need to go back to the extensions choice step which is the last modules choice step in the wizard - $iCountModulesChoiceSteps = count(array_filter($aWizardSteps, fn (array $step): bool => $step['class'] === WizStepModulesChoice::class)); - array_pop($aWizardSteps); - $this->oWizard->SetWizardSteps($aWizardSteps); - $this->oWizard->SetParameter('_steps', $aWizardSteps); - return new WizardState(WizStepModulesChoice::class, $iCountModulesChoiceSteps - 1); + return $this->oWizard->GetLatestWizardStateFromStepClass(WizStepModulesChoice::class); } }