WIP: fix unattended

This commit is contained in:
odain
2026-04-02 19:18:41 +02:00
parent 4ed3323956
commit 9cfaf59669
2 changed files with 21 additions and 15 deletions

View File

@@ -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);
}
}

View File

@@ -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");
}
}