N°2013 Setup : fix crash on compilation if initial DB info were wrong

Use case :
- having in the iTop config file wrong DB parameters (unreachable server for example)
- launch the setup in update mode
- fix the DB config in the wizard

The PR #351 solved the errors that were happening in the following steps.
But we still had an error during compilation, caused by the maintenance mode activation.
This commit is contained in:
Pierre Goiffon
2023-01-09 16:11:27 +01:00
parent cf4616d9a1
commit 15d3201a40
2 changed files with 22 additions and 3 deletions

View File

@@ -286,8 +286,9 @@ class ApplicationInstaller
}
}
$aParamValues = $this->oParams->GetParamForConfigArray();
self::DoCompile($aSelectedModules, $sSourceDir, $sExtensionDir, $sTargetDir, $sTargetEnvironment,
$bUseSymbolicLinks);
$bUseSymbolicLinks, $aParamValues);
$aResult = array(
'status' => self::OK,
@@ -510,7 +511,22 @@ class ApplicationInstaller
}
protected static function DoCompile($aSelectedModules, $sSourceDir, $sExtensionDir, $sTargetDir, $sEnvironment, $bUseSymbolicLinks = null)
/**
* @param array $aSelectedModules
* @param string $sSourceDir
* @param string $sExtensionDir
* @param string $sTargetDir
* @param string $sEnvironment
* @param boolean $bUseSymbolicLinks
* @param array $aParamValues
*
* @return void
* @throws \ConfigException
* @throws \CoreException
*
* @since 3.1.0 N°2013 added the aParamValues param
*/
protected static function DoCompile($aSelectedModules, $sSourceDir, $sExtensionDir, $sTargetDir, $sEnvironment, $bUseSymbolicLinks = null, $aParamValues = [])
{
SetupLog::Info("Compiling data model.");
@@ -520,7 +536,7 @@ class ApplicationInstaller
if (empty($sSourceDir) || empty($sTargetDir)) {
throw new Exception("missing parameter source_dir and/or target_dir");
}
}
$sSourcePath = APPROOT.$sSourceDir;
$aDirsToScan = array($sSourcePath);
@@ -554,6 +570,7 @@ class ApplicationInstaller
{
$oConfig = null;
}
$oConfig->UpdateFromParams($aParamValues);
SetupUtils::EnterMaintenanceMode($oConfig);
}