From 03e59c9749b2a168d7eb5cc05e6e28b476a56370 Mon Sep 17 00:00:00 2001 From: odain Date: Thu, 22 Jan 2026 15:54:15 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B08764=20-=20fix=20missing=20setup=20wizar?= =?UTF-8?q?ds=20titles=20+=20cache=20step=20computation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/extensionsmap.class.inc.php | 2 - setup/wizardsteps.class.inc.php | 81 ++++++++++++++----------------- 2 files changed, 36 insertions(+), 47 deletions(-) diff --git a/setup/extensionsmap.class.inc.php b/setup/extensionsmap.class.inc.php index de53d11c4..a187df516 100644 --- a/setup/extensionsmap.class.inc.php +++ b/setup/extensionsmap.class.inc.php @@ -379,11 +379,9 @@ class iTopExtensionsMap { $aRes = []; foreach ($this->GetAllExtensionsWithPreviouslyInstalled() as $oExtension) { - \IssueLog::Error($oExtension->sCode.' '.__METHOD__.__LINE__); /** @var \iTopExtension $oExtension */ if (($oExtension->sSource !== iTopExtension::SOURCE_WIZARD) && ($oExtension->bVisible)) { if ($bKeepMissingDependencyExtensions || (count($oExtension->aMissingDependencies) == 0)) { - if (!$oExtension->bMandatory) { $oExtension->bMandatory = ($oExtension->sSource === iTopExtension::SOURCE_REMOTE); } diff --git a/setup/wizardsteps.class.inc.php b/setup/wizardsteps.class.inc.php index bb0918dbd..fab3c92b8 100644 --- a/setup/wizardsteps.class.inc.php +++ b/setup/wizardsteps.class.inc.php @@ -1325,6 +1325,8 @@ class WizStepModulesChoice extends WizardStep */ protected iTopExtensionsMap $oExtensionsMap; + private ?array $aSteps = null; + protected PhpExpressionEvaluator $oPhpExpressionEvaluator; /** @@ -1370,15 +1372,11 @@ class WizStepModulesChoice extends WizardStep } } - public function GetTitle() + public function GetTitle(): string { - if (@file_exists($this->GetSourceFilePath())) { - // Found an "installation.xml" file, let's use this definition for the wizard - return 'Extensions'; - } + $aStepInfo = $this->GetStepInfo(); - // 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. - return 'Modules Selection'; + return $aStepInfo['title'] ?? 'Modules selection'; } public function GetPossibleSteps() @@ -1893,51 +1891,44 @@ EOF protected function GetStepInfo($idx = null) { - $aStepInfo = null; - if ($idx === null) { - $index = $this->GetStepIndex(); - } else { - $index = $idx; - } + $index = $idx ?? $this->GetStepIndex(); - $aSteps = []; - $this->oWizard->SetParameter('additional_extensions_modules', json_encode([])); // Default value, no additional extensions + if (is_null($this->aSteps)) { + $this->aSteps = []; + $this->oWizard->SetParameter('additional_extensions_modules', json_encode([])); // Default value, no additional extensions - $aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo(); - if (@file_exists($this->GetSourceFilePath())) { - // Found an "installation.xml" file, let's use this definition for the wizard - $aParams = new XMLParameters($this->GetSourceFilePath()); - $aSteps = $aParams->Get('steps', []); + $aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo(); + if (@file_exists($this->GetSourceFilePath())) { + // Found an "installation.xml" file, let's use this definition for the wizard + $aParams = new XMLParameters($this->GetSourceFilePath()); + $this->aSteps = $aParams->Get('steps', []); - // Additional step for the "extensions" - $aStepDefinition = [ - 'title' => 'Extensions', - 'description' => '

Select additional extensions to install. You can launch the installation again to install new extensions or remove installed ones.

', - 'banner' => '/images/icons/icons8-puzzle.svg', - 'options' => $aOptions, - ]; + // Additional step for the "extensions" + $aStepDefinition = [ + 'title' => 'Extensions', + 'description' => '

Select additional extensions to install. You can launch the installation again to install new extensions or remove installed ones.

', + 'banner' => '/images/icons/icons8-puzzle.svg', + 'options' => $aOptions, + ]; - // Display this step of the wizard only if there is something to display - if (count($aStepDefinition['options']) !== 0) { - $this->oWizard->SetParameter('additional_extensions_modules', json_encode($aStepDefinition['options'])); + // Display this step of the wizard only if there is something to display + if (count($aOptions) > 0) { + $this->oWizard->SetParameter('additional_extensions_modules', json_encode($aOptions)); + } + } else { + // 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. + $aStepDefinition = [ + 'title' => 'Modules Selection', + 'description' => '

Select the modules to install. You can launch the installation again to install new modules, but you cannot remove already installed modules.

', + 'banner' => '/images/icons/icons8-apps-tab.svg', + 'options' => $aOptions, + ]; } - } else { - // 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. - $aStepDefinition = [ - 'title' => 'Modules Selection', - 'description' => '

Select the modules to install. You can launch the installation again to install new modules, but you cannot remove already installed modules.

', - 'banner' => '/images/icons/icons8-apps-tab.svg', - 'options' => $aOptions, - ]; + + $this->aSteps[] = $aStepDefinition; } - $aSteps[] = $aStepDefinition; - - if (array_key_exists($index, $aSteps)) { - $aStepInfo = $aSteps[$index]; - } - - return $aStepInfo; + return $this->aSteps[$index] ?? null; } public function ComputeChoiceFlags(array $aChoice, string $sChoiceId, array $aSelectedComponents, bool $bAllDisabled, bool $bDisableUninstallCheck, bool $bUpgradeMode)