mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°7439 - setup wizard broken on essential targets
This commit is contained in:
@@ -21,6 +21,7 @@ class InstallationFileService {
|
||||
private $sInstallationPath;
|
||||
private $aSelectedModules;
|
||||
private $aSelectedExtensions;
|
||||
private $aAfterComputationSelectedExtensions;
|
||||
private $aUnSelectedModules;
|
||||
private $aAutoSelectModules;
|
||||
private $bInstallationOptionalChoicesChecked;
|
||||
@@ -37,6 +38,7 @@ class InstallationFileService {
|
||||
$this->aUnSelectedModules = [];
|
||||
$this->sTargetEnvironment = $sTargetEnvironment;
|
||||
$this->aSelectedExtensions = $aSelectedExtensions;
|
||||
$this->aAfterComputationSelectedExtensions = (count($aSelectedExtensions)==0) ? [] : $aSelectedExtensions;
|
||||
$this->bInstallationOptionalChoicesChecked = $bInstallationOptionalChoicesChecked;
|
||||
}
|
||||
|
||||
@@ -51,6 +53,10 @@ class InstallationFileService {
|
||||
$this->oProductionEnv = $oProductionEnv;
|
||||
}
|
||||
|
||||
public function GetAfterComputationSelectedExtensions(): array {
|
||||
return $this->aAfterComputationSelectedExtensions;
|
||||
}
|
||||
|
||||
public function GetAutoSelectModules(): array {
|
||||
return $this->aAutoSelectModules;
|
||||
}
|
||||
@@ -146,10 +152,13 @@ class InstallationFileService {
|
||||
$sMandatory = $aChoiceInfo["mandatory"] ?? "false";
|
||||
|
||||
$aCurrentModules = $aChoiceInfo["modules"] ?? [];
|
||||
$sExtensionCode = $aChoiceInfo["extension_code"] ?? null;
|
||||
if (0 === count($this->aSelectedExtensions)){
|
||||
$bSelected = $bAllChecked || $sDefault === "true" || $sMandatory === "true";
|
||||
if ($bSelected){
|
||||
$this->aAfterComputationSelectedExtensions[]= $sExtensionCode;
|
||||
}
|
||||
} else {
|
||||
$sExtensionCode = $aChoiceInfo["extension_code"] ?? null;
|
||||
$bSelected = $sMandatory === "true" ||
|
||||
(null !== $sExtensionCode && in_array($sExtensionCode, $this->aSelectedExtensions));
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ if (! is_null($sInstallationXmlPath) && is_file($sInstallationXmlPath)) {
|
||||
$sInstallationBaseName = basename($sInstallationXmlPath);
|
||||
|
||||
$aSelectedExtensionsFromXmlSetup = $oParams->Get('selected_extensions', []);
|
||||
if (count($aSelectedExtensionsFromXmlSetup) !== 0) {
|
||||
$bInstallationChoicesProvided = count($aSelectedExtensionsFromXmlSetup) !== 0;
|
||||
if ($bInstallationChoicesProvided) {
|
||||
$sMsg = "Modules to install computed based on $sInstallationBaseName file and installation choices (listed in section `selected_extensions` of $sXmlSetupBaseName file)";
|
||||
echo "$sMsg:\n".implode(',', $aSelectedExtensionsFromXmlSetup)."\n\n";
|
||||
SetupLog::Info($sMsg, null, $aSelectedExtensionsFromXmlSetup);
|
||||
@@ -75,11 +76,21 @@ if (! is_null($sInstallationXmlPath) && is_file($sInstallationXmlPath)) {
|
||||
|
||||
$oInstallationFileService = new InstallationFileService($sInstallationXmlPath, $sTargetEnvironment, $aSelectedExtensionsFromXmlSetup);
|
||||
$oInstallationFileService->Init();
|
||||
|
||||
$aComputedExtensions = $oInstallationFileService->GetAfterComputationSelectedExtensions();
|
||||
if (! $bInstallationChoicesProvided) {
|
||||
$sMsg = "Computed installation choices";
|
||||
echo "$sMsg:\n".implode(',', $aComputedExtensions)."\n\n";
|
||||
SetupLog::Info($sMsg, null, $aComputedExtensions);
|
||||
}
|
||||
$aSelectedExtensions = array_keys($aComputedExtensions);
|
||||
$oParams->Set('selected_extensions', $aSelectedExtensions);
|
||||
|
||||
$aComputedModules = $oInstallationFileService->GetSelectedModules();
|
||||
$aSelectedModules = array_keys($aComputedModules);
|
||||
$oParams->Set('selected_modules', $aSelectedModules);
|
||||
|
||||
$sMsg = "Modules to install computed";
|
||||
$sMsg = "Computed modules to install";
|
||||
} else {
|
||||
$aSelectedModules = $oParams->Get('selected_modules', []);
|
||||
$sMsg = "Modules to install listed in $sXmlSetupBaseName (selected_modules section)";
|
||||
|
||||
Reference in New Issue
Block a user