N°8981 setup wizard: reuse AnalyzeInstallation result in wizard module choice step

This commit is contained in:
odain
2026-01-05 22:17:23 +01:00
parent 9f3b8ec964
commit 57b3610100
2 changed files with 17 additions and 11 deletions

View File

@@ -698,7 +698,6 @@ class ApplicationInstaller
}
// Module specific actions (migrate the data)
//
$aAvailableModules = $oProductionEnv->AnalyzeInstallation(MetaModel::GetConfig(), APPROOT.$sModulesDir);
$oProductionEnv->CallInstallerHandlers($aAvailableModules, 'BeforeDatabaseCreation', $aSelectedModules);

View File

@@ -1334,6 +1334,9 @@ class WizStepModulesChoice extends WizardStep
*/
protected bool $bChoicesFromDatabase;
private array $aAnalyzeInstallationModules;
private ?MissingDependencyException $oMissingDependencyException = null;
public function __construct(WizardController $oWizard, $sCurrentState)
{
parent::__construct($oWizard, $sCurrentState);
@@ -1358,6 +1361,14 @@ class WizStepModulesChoice extends WizardStep
$this->oExtensionsMap->LoadChoicesFromDatabase($this->oConfig);
$this->bChoicesFromDatabase = true;
}
// Sanity check (not stopper, to let developers go further...)
try {
$this->aAnalyzeInstallationModules = SetupUtils::AnalyzeInstallation($this->oWizard, true);
} catch (MissingDependencyException $e) {
$this->oMissingDependencyException = $e;
$this->aAnalyzeInstallationModules = SetupUtils::AnalyzeInstallation($this->oWizard);
}
}
public function GetTitle()
@@ -1449,10 +1460,8 @@ class WizStepModulesChoice extends WizardStep
protected function DisplayStep($oPage)
{
// Sanity check (not stopper, to let developers go further...)
try {
SetupUtils::AnalyzeInstallation($this->oWizard, true);
} catch (MissingDependencyException $e) {
$oPage->warning($e->getHtmlDesc(), $e->getMessage());
if (! is_null($this->oMissingDependencyException)) {
$oPage->warning($this->oMissingDependencyException->getHtmlDesc(), $this->oMissingDependencyException->getMessage());
}
$this->bUpgrade = ($this->oWizard->GetParameter('install_mode') != 'install');
@@ -1463,9 +1472,8 @@ class WizStepModulesChoice extends WizardStep
$oPage->add_style(".choice-disabled { color: #999; }");
$oPage->add_style("input.unremovable { accent-color: orangered;}");
$aModules = SetupUtils::AnalyzeInstallation($this->oWizard);
$sManualInstallError = SetupUtils::CheckManualInstallDirEmpty(
$aModules,
$this->aAnalyzeInstallationModules,
$this->oWizard->GetParameter('extensions_dir', 'extensions')
);
if ($sManualInstallError !== '') {
@@ -1491,7 +1499,7 @@ class WizStepModulesChoice extends WizardStep
$oPage->add('</div>');
// Build the default choices
$aDefaults = $this->GetDefaults($aStepInfo, $aModules);
$aDefaults = $this->GetDefaults($aStepInfo, $this->aAnalyzeInstallationModules);
$index = $this->GetStepIndex();
// retrieve the saved selection
@@ -1751,7 +1759,7 @@ EOF
{
if ($sParentId == '') {
// Check once (before recursing) that the hidden modules are selected
foreach (SetupUtils::AnalyzeInstallation($this->oWizard) as $sModuleId => $aModule) {
foreach ($this->aAnalyzeInstallationModules as $sModuleId => $aModule) {
if (($sModuleId != ROOT_MODULE) && !isset($aModules[$sModuleId])) {
if (($aModule['category'] == 'authentication') || (!$aModule['visible'] && !isset($aModule['auto_select']))) {
$aModules[$sModuleId] = true;
@@ -1841,11 +1849,10 @@ EOF
if ($sParentId == '') {
// Last pass (after all the user's choices are turned into "selected" modules):
// Process 'auto_select' modules for modules that are not already selected
$aAvailableModules = SetupUtils::AnalyzeInstallation($this->oWizard);
do {
// Loop while new modules are added...
$bModuleAdded = false;
foreach ($aAvailableModules as $sModuleId => $aModule) {
foreach ($this->aAnalyzeInstallationModules as $sModuleId => $aModule) {
if (($sModuleId != ROOT_MODULE) && !array_key_exists($sModuleId, $aModules) && isset($aModule['auto_select'])) {
try {
SetupInfo::SetSelectedModules($aModules);