diff --git a/setup/runtimeenv.class.inc.php b/setup/runtimeenv.class.inc.php index e2032249d..ea464b1eb 100644 --- a/setup/runtimeenv.class.inc.php +++ b/setup/runtimeenv.class.inc.php @@ -24,6 +24,7 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ +use Combodo\iTop\Application\Helper\Session; use Combodo\iTop\PhpParser\Evaluation\PhpExpressionEvaluator; use Combodo\iTop\Setup\FeatureRemoval\SetupAudit; use Combodo\iTop\Setup\ModuleDiscovery\ModuleFileReader; @@ -165,7 +166,12 @@ class RunTimeEnvironment MetaModel::ResetAllCaches($this->sBuildEnv); } - MetaModel::Startup($oConfig, $bModelOnly, $bUseCache, false /* $bTraceSourceFiles */, $this->sBuildEnv); + if (! isset($_SESSION)) { + $_SESSION = []; + } + Session::Set('itop_env', $this->sBuildEnv); + + MetaModel::Startup($oConfig, $bModelOnly, $bUseCache, false, $this->sBuildEnv); self::$bMetamodelStarted = true; if ($this->oExtensionsMap === null) { @@ -630,7 +636,7 @@ class RunTimeEnvironment */ public function UpdateDBSchema(Config $oConfig, string $sMode, ?array $aSelectedModules = null): void { - $this->InitDataModel($oConfig, true); // load data model only + $this->InitDataModel($oConfig); // load data model only // Module specific actions (migrate the data) $aAvailableModules = $this->AnalyzeInstallation($oConfig, $this->GetBuildDir()); @@ -1018,6 +1024,7 @@ class RunTimeEnvironment @rmdir(dirname($sBuildConfig)); // Cleanup the temporary build dir if empty MetaModel::ResetAllCaches($this->sFinalEnv); + Session::Set('itop_env', $this->sFinalEnv); } } diff --git a/setup/sequencers/ApplicationInstallSequencer.php b/setup/sequencers/ApplicationInstallSequencer.php index dbb134781..8ddae2a82 100644 --- a/setup/sequencers/ApplicationInstallSequencer.php +++ b/setup/sequencers/ApplicationInstallSequencer.php @@ -109,7 +109,7 @@ class ApplicationInstallSequencer extends StepSequencer $aSelectedModules = $this->oParams->Get('selected_modules', []); $bSampleData = ($this->oParams->Get('sample_data', 0) == 1); - $this->oRunTimeEnvironment->DoLoadData($this->GetConfig(),$bSampleData, $aSelectedModules); + $this->oRunTimeEnvironment->DoLoadData($this->GetConfig(), $bSampleData, $aSelectedModules); return $this->GetNextStep('create-config', 'Creating the configuration File', 80, 'All data loaded'); @@ -118,7 +118,8 @@ class ApplicationInstallSequencer extends StepSequencer $aSelectedModuleCodes = $this->oParams->Get('selected_modules', []); $aSelectedExtensionCodes = $this->oParams->Get('selected_extensions', []); - $this->oRunTimeEnvironment->DoCreateConfig($this->GetConfig(), + $this->oRunTimeEnvironment->DoCreateConfig( + $this->GetConfig(), $sDataModelVersion, $aSelectedModuleCodes, $aSelectedExtensionCodes, @@ -134,18 +135,16 @@ class ApplicationInstallSequencer extends StepSequencer default: return $this->GetNextStep('', "Unknown setup step '$sStep'.", 100, '', self::ERROR); } + } catch (Exception $e) { + $this->ReportException($e); + $aResult = $this->GetNextStep('', '', 100, $e->getMessage(), self::ERROR); + $aResult['error_code'] = $e->getCode(); + return $aResult; + } finally { + $this->ExitReadOnlyMode(); + $fDuration = round(microtime(true) - $fStart, 2); + SetupLog::Info("##### STEP {$sStep} duration: {$fDuration}s"); } - catch (Exception $e) { - $this->ReportException($e); - $aResult = $this->GetNextStep('', '', 100, $e->getMessage(), self::ERROR); - $aResult['error_code'] = $e->getCode(); - return $aResult; - } - finally { - $this->ExitReadOnlyMode(); - $fDuration = round(microtime(true) - $fStart, 2); - SetupLog::Info("##### STEP {$sStep} duration: {$fDuration}s"); - } }