Fix sessions

This commit is contained in:
Eric Espie
2026-04-03 15:40:37 +02:00
parent 0d0261b0cc
commit 3590ddedf0
5 changed files with 16 additions and 33 deletions

View File

@@ -167,7 +167,8 @@ class RunTimeEnvironment
}
if (! isset($_SESSION)) {
$_SESSION = [];
Session::$bAllowCLI = true;
Session::Start();
}
Session::Set('itop_env', $this->sBuildEnv);
@@ -1024,6 +1025,10 @@ class RunTimeEnvironment
@rmdir(dirname($sBuildConfig)); // Cleanup the temporary build dir if empty
MetaModel::ResetAllCaches($this->sFinalEnv);
if (! isset($_SESSION)) {
Session::$bAllowCLI = true;
Session::Start();
}
Session::Set('itop_env', $this->sFinalEnv);
}
}

View File

@@ -175,11 +175,14 @@ class ApplicationInstallSequencer extends StepSequencer
}
/**
* @param \Config $oConfig
* @param $aSelectedModules
*
* @throws \ConfigException
* @throws \CoreException
* @throws \DictExceptionUnknownLanguage
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \OQLException
*/
protected function DoUpdateDBSchema(Config $oConfig, $aSelectedModules)
{

View File

@@ -149,8 +149,7 @@ class WizardController
{
$sCurrentStepClass = utils::ReadParam('_class', $this->sInitialStepClass);
$sCurrentState = utils::ReadParam('_state', $this->sInitialState);
/** @var \WizardStep $oStep */
$oStep = $oStep = $this->GetWizardStep($sCurrentStepClass, $sCurrentState);
$oStep = $this->GetWizardStep($sCurrentStepClass, $sCurrentState);
if ($oStep->ValidateParams()) {
if ($oStep->CanComeBack()) {
$this->PushStep(['class' => $sCurrentStepClass, 'state' => $sCurrentState]);
@@ -177,7 +176,7 @@ class WizardController
$sCurrentStepClass = utils::ReadParam('_class', $this->sInitialStepClass);
$sCurrentState = utils::ReadParam('_state', $this->sInitialState);
$oStep = $this->GetWizardStep($sCurrentStepClass, $sCurrentState);
$oWizardState = $oStep->UpdateWizardStateAndGetNextStep(false); // false => Moving backwards
$oStep->UpdateWizardStateAndGetNextStep(false); // false => Moving backwards
// Display the previous step
$aCurrentStepInfo = $this->PopStep();

View File

@@ -68,12 +68,10 @@ class WizStepInstall extends AbstractWizStepInstall
$oPage->add('</div>'); // progress_content
$oPage->add('</fieldset>');
$oPage->add("<div class=\"message message-error ibo-is-html-content\" style=\"display:none;\" id=\"setup_error\"></div>");
}
public function Display(WebPage $oPage)
{
$aInstallParams = $this->BuildConfig();
$this->AddProgressBar($oPage, 'Progress of the installation');
@@ -91,27 +89,10 @@ JS);
return;
}
//When the setup reach this step, it already checked whether extensions were uninstallable (during WizStepModulesChoice). We only need to log what has been done.
if ($this->oWizard->GetParameter('force-uninstall', false)) {
SetupLog::Warning("User disabled uninstallation checks");
}
$aExtensionsRemoved = json_decode($this->oWizard->GetParameter('removed_extensions'), true) ?? [];
$aExtensionsNotUninstallable = json_decode($this->oWizard->GetParameter('extensions_not_uninstallable'));
$aExtensionsForceUninstalled = [];
foreach ($aExtensionsRemoved as $sExtensionCode => $sLabel) {
if (in_array($sExtensionCode, $aExtensionsNotUninstallable)) {
$aExtensionsForceUninstalled[] = $sExtensionCode;
}
}
if (count($aExtensionsForceUninstalled)) {
SetupLog::Warning("Extensions uninstalled forcefully : ".implode(',', $aExtensionsForceUninstalled));
}
$oPage->add_ready_script(<<<JS
$("#wiz_form").data("installation_status", "not started");
ExecuteStep("");
JS);
}
/**
@@ -126,7 +107,7 @@ JS);
/** @var StepSequencer $oInstaller */
$oInstaller = new (static::SequencerClass)($oParameters);
$aRes = $oInstaller->ExecuteStep($sStep);
if (($aRes['status'] != $oInstaller::ERROR) && ($aRes['next-step'] != '')) {
if (($aRes['status'] !== StepSequencer::ERROR) && ($aRes['next-step'] != '')) {
// Tell the web page to move the progress bar and to launch the next step
$sMessage = addslashes(utils::EscapeHtml($aRes['next-step-label']));
$oPage->add_ready_script(
@@ -140,7 +121,7 @@ JS);
ExecuteStep('{$aRes['next-step']}');
EOF
);
} elseif ($aRes['status'] != $oInstaller::ERROR) {
} elseif ($aRes['status'] !== StepSequencer::ERROR) {
// Installation complete, move to the next step of the wizard
$oPage->add_ready_script(
<<<EOF

View File

@@ -94,7 +94,7 @@ class WizStepModulesChoice extends WizardStep
public function GetPossibleSteps()
{
return [WizStepModulesChoice::class, WizStepDataAudit::class, WizStepSummary::class];
return [WizStepModulesChoice::class, WizStepDataAudit::class];
}
public function GetAddedAndRemovedExtensions($aSelectedExtensions)
@@ -166,13 +166,8 @@ class WizStepModulesChoice extends WizardStep
$this->oWizard->SetParameter('extensions_added', json_encode($aExtensionsAdded));
$this->oWizard->SetParameter('removed_extensions', json_encode($aExtensionsRemoved));
$this->oWizard->SetParameter('extensions_not_uninstallable', json_encode(array_keys($aExtensionsNotUninstallable)));
$sMode = $this->oWizard->GetParameter('mode', 'install');
if ($sMode == 'install' || !$this->IsDataAuditEnabled()) {
return new WizardState(WizStepSummary::class);
} else {
return new WizardState(WizStepDataAudit::class);
}
return new WizardState(WizStepDataAudit::class);
}
}