From 6f34a4799c0289d03b1778325f293efb437a19c2 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Fri, 29 May 2026 17:22:59 +0200 Subject: [PATCH 1/4] Setup fast track --- setup/ajax.dataloader.php | 1 + setup/wizard.php | 1 + setup/wizardcontroller.class.inc.php | 6 +- .../wizardsteps/WizStepLandingBeforeAudit.php | 12 +- setup/wizardsteps/WizStepWelcome.php | 120 +++++++++++++----- setup/wizardsteps/WizardStep.php | 4 + 6 files changed, 106 insertions(+), 38 deletions(-) diff --git a/setup/ajax.dataloader.php b/setup/ajax.dataloader.php index 53c672faa2..70f1df4303 100644 --- a/setup/ajax.dataloader.php +++ b/setup/ajax.dataloader.php @@ -123,6 +123,7 @@ function FatalErrorCatcher($sOutput) // Never cache this page header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Fri, 17 Jul 1970 05:00:00 GMT"); // Date in the past +$oCtx = new ContextTag(ContextTag::TAG_SETUP); /** * Main program diff --git a/setup/wizard.php b/setup/wizard.php index f48fda0c29..ae60b090d4 100644 --- a/setup/wizard.php +++ b/setup/wizard.php @@ -61,6 +61,7 @@ function json_decode($json, $assoc = null) //N°3671 setup context: force $bForceTrustProxy to be persisted in next calls utils::GetAbsoluteUrlAppRoot(true); $oWizard = new WizardController('WizStepWelcome'); +$oCtx = new ContextTag(ContextTag::TAG_SETUP); //N°3952 if (SetupUtils::IsSessionSetupTokenValid()) { // Normal operation diff --git a/setup/wizardcontroller.class.inc.php b/setup/wizardcontroller.class.inc.php index eace6760da..964c83fd67 100644 --- a/setup/wizardcontroller.class.inc.php +++ b/setup/wizardcontroller.class.inc.php @@ -220,6 +220,8 @@ protected function DisplayStep(WizardStep $oStep): void } } $oPage->LinkScriptFromAppRoot('setup/setup.js'); + $oStep->PreFormDisplay($oPage); + $oPage->add('
'); $oPage->add('
'); $oStep->Display($oPage); @@ -283,8 +285,8 @@ protected function DisplayStep(WizardStep $oStep): void $oPage->output(); } /** - * Make the wizard run: Start, Next or Back depending WizardUpdateButtons(); -on the page's parameters + * Make the wizard run: 'Start', 'Next' or 'Back' depending WizardUpdateButtons(); + * on the page's parameters */ public function Run() { diff --git a/setup/wizardsteps/WizStepLandingBeforeAudit.php b/setup/wizardsteps/WizStepLandingBeforeAudit.php index e29674720e..7971b532c4 100644 --- a/setup/wizardsteps/WizStepLandingBeforeAudit.php +++ b/setup/wizardsteps/WizStepLandingBeforeAudit.php @@ -40,8 +40,8 @@ public function Display(SetupPage $oPage): void */ public function UpdateWizardStateAndGetNextStep($bMoveForward = true): WizardState { - $oProductionEnv = new RunTimeEnvironment(); - $sBuildConfigFile = APPCONF.$oProductionEnv->GetBuildEnv().'/'.ITOP_CONFIG_FILE; + $oRuntimeEnv = new RunTimeEnvironment(); + $sBuildConfigFile = APPCONF.$oRuntimeEnv->GetBuildEnv().'/'.ITOP_CONFIG_FILE; @chmod($sBuildConfigFile, 0770); // In case it exists: RWX for owner and group, nothing for others $oConfig = new Config($sBuildConfigFile); @@ -56,6 +56,14 @@ public function UpdateWizardStateAndGetNextStep($bMoveForward = true): WizardSta $this->oWizard->SetParameter('display_choices', '[]'); $this->oWizard->SetParameter('extensions_not_uninstallable', '[]'); + if ($this->oWizard->GetParameter('skip_wizard', false)) { + $oExtensionMap = new iTopExtensionsMap($oRuntimeEnv->GetBuildEnv()); + $aExtensionsFromDatabase = $oExtensionMap->GetChoicesFromDatabase($oConfig); + $this->oWizard->SetParameter('selected_extensions', json_encode($aExtensionsFromDatabase)); + $adModulesFromDatabase = ModuleInstallationRepository::GetInstance()->ReadComputeInstalledModules($oConfig); + $this->oWizard->SetParameter('selected_modules', json_encode(array_keys($adModulesFromDatabase))); + } + $aWizardSteps = $this->GetWizardSteps(); $this->oWizard->SetWizardSteps($aWizardSteps); $this->sCurrentState = count($aWizardSteps) - 1; diff --git a/setup/wizardsteps/WizStepWelcome.php b/setup/wizardsteps/WizStepWelcome.php index c89389a16c..2db53d59b9 100644 --- a/setup/wizardsteps/WizStepWelcome.php +++ b/setup/wizardsteps/WizStepWelcome.php @@ -18,14 +18,21 @@ * You should have received a copy of the GNU Affero General Public License */ -use Combodo\iTop\Application\WebPage\WebPage; - /** * First step of the iTop Installation Wizard: Welcome screen, requirements */ class WizStepWelcome extends WizardStep { protected $bCanMoveForward; + private array $aInfo; + private array $aWarnings; + private array $aErrors; + + public function __construct(WizardController $oWizard, $sCurrentState) + { + parent::__construct($oWizard, $sCurrentState); + $this->CheckInstallation(); + } public function GetTitle() { @@ -70,39 +77,14 @@ public function Display(SetupPage $oPage): void EOF ); $oPage->add('

'.ITOP_APPLICATION.' Installation Wizard

'); - $aResults = SetupUtils::CheckPhpAndExtensions(); - $this->bCanMoveForward = true; - $aInfo = []; - $aWarnings = []; - $aErrors = []; - foreach ($aResults as $oCheckResult) { - switch ($oCheckResult->iSeverity) { - case CheckResult::ERROR: - $aErrors[] = $oCheckResult->sLabel; - $this->bCanMoveForward = false; - break; - - case CheckResult::WARNING: - $aWarnings[] = $oCheckResult->sLabel; - break; - - case CheckResult::INFO: - $aInfo[] = $oCheckResult->sLabel; - break; - - case CheckResult::TRACE: - SetupLog::Ok($oCheckResult->sLabel); - break; - } - } $sStyle = 'style="display:none;overflow:auto;"'; $sToggleButtons = ''; - if (count($aErrors) > 0) { + if (count($this->aErrors) > 0) { $sStyle = 'overflow:auto;"'; - $sTitle = count($aErrors).' Error(s), '.count($aWarnings).' Warning(s).'; + $sTitle = count($this->aErrors).' Error(s), '.count($this->aWarnings).' Warning(s).'; $sH2Class = 'text-error'; - } elseif (count($aWarnings) > 0) { - $sTitle = count($aWarnings).' Warning(s) '.$sToggleButtons; + } elseif (count($this->aWarnings) > 0) { + $sTitle = count($this->aWarnings).' Warning(s) '.$sToggleButtons; $sH2Class = 'text-warning'; } else { $sTitle = 'Ok. '.$sToggleButtons; @@ -114,13 +96,13 @@ public function Display(SetupPage $oPage): void
HTML ); - foreach ($aErrors as $sText) { + foreach ($this->aErrors as $sText) { $oPage->error($sText); } - foreach ($aWarnings as $sText) { + foreach ($this->aWarnings as $sText) { $oPage->warning($sText); } - foreach ($aInfo as $sText) { + foreach ($this->aInfo as $sText) { $oPage->ok($sText); } $oPage->add('
'); @@ -131,8 +113,78 @@ public function Display(SetupPage $oPage): void $oPage->add_ready_script('CheckDirectoryConfFilesPermissions("'.utils::GetItopVersionWikiSyntax().'")'); } + /** + * Add post display stuff to the setup screen + * @param \SetupPage $oPage + * + * @return void + */ + public function PreFormDisplay(SetupPage $oPage) + { + if ($this->bCanMoveForward) { + $sBuildConfigFile = APPCONF.ITOP_DEFAULT_ENV.'/'.ITOP_CONFIG_FILE; + if (file_exists($sBuildConfigFile)) { + $oContextTag = new ContextTag(ContextTag::TAG_SETUP); + $sToken = SetupUtils::CreateSetupToken(); + $oPage->add( + << + Fast track + + + + + + + + + + +
+ + +
+ Normal track +
+HTML + ); + } + } + } + public function CanMoveForward() { return $this->bCanMoveForward; } + + /** + */ + public function CheckInstallation(): void + { + $aResults = SetupUtils::CheckPhpAndExtensions(); + $this->bCanMoveForward = true; + $this->aInfo = []; + $this->aWarnings = []; + $this->aErrors = []; + foreach ($aResults as $oCheckResult) { + switch ($oCheckResult->iSeverity) { + case CheckResult::ERROR: + $this->aErrors[] = $oCheckResult->sLabel; + $this->bCanMoveForward = false; + break; + + case CheckResult::WARNING: + $this->aWarnings[] = $oCheckResult->sLabel; + break; + + case CheckResult::INFO: + $this->aInfo[] = $oCheckResult->sLabel; + break; + + case CheckResult::TRACE: + SetupLog::Ok($oCheckResult->sLabel); + break; + } + } + } } diff --git a/setup/wizardsteps/WizardStep.php b/setup/wizardsteps/WizardStep.php index bad393a3e2..e7caa22a10 100644 --- a/setup/wizardsteps/WizardStep.php +++ b/setup/wizardsteps/WizardStep.php @@ -76,6 +76,10 @@ public function PostFormDisplay(SetupPage $oPage) { } + public function PreFormDisplay(SetupPage $oPage) + { + } + protected function CheckDependencies() { if (is_null($this->bDependencyCheck)) { From 1aa249b59fc90ef34c49ec1685433166d8a196c3 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Fri, 29 May 2026 17:40:05 +0200 Subject: [PATCH 2/4] Setup fast track (fix setup token) --- setup/wizard.php | 2 +- setup/wizardsteps/WizStepWelcome.php | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/setup/wizard.php b/setup/wizard.php index ae60b090d4..374fb71be9 100644 --- a/setup/wizard.php +++ b/setup/wizard.php @@ -70,5 +70,5 @@ function json_decode($json, $assoc = null) SetupUtils::ExitMaintenanceMode(false); // Force initializing the setup $oWizard->Start(); - SetupUtils::CreateSetupToken(); + //SetupUtils::CreateSetupToken(); } diff --git a/setup/wizardsteps/WizStepWelcome.php b/setup/wizardsteps/WizStepWelcome.php index 2db53d59b9..be2338c0ce 100644 --- a/setup/wizardsteps/WizStepWelcome.php +++ b/setup/wizardsteps/WizStepWelcome.php @@ -27,11 +27,13 @@ class WizStepWelcome extends WizardStep private array $aInfo; private array $aWarnings; private array $aErrors; + private string $sUID; public function __construct(WizardController $oWizard, $sCurrentState) { parent::__construct($oWizard, $sCurrentState); $this->CheckInstallation(); + $this->sUID = SetupUtils::CreateSetupToken(); } public function GetTitle() @@ -55,8 +57,7 @@ public function GetPossibleSteps() public function UpdateWizardStateAndGetNextStep($bMoveForward = true): WizardState { - $sUID = SetupUtils::CreateSetupToken(); - $this->oWizard->SetParameter('authent', $sUID); + $this->oWizard->SetParameter('authent', $this->sUID); return new WizardState(WizStepInstallOrUpgrade::class); } @@ -124,8 +125,6 @@ public function PreFormDisplay(SetupPage $oPage) if ($this->bCanMoveForward) { $sBuildConfigFile = APPCONF.ITOP_DEFAULT_ENV.'/'.ITOP_CONFIG_FILE; if (file_exists($sBuildConfigFile)) { - $oContextTag = new ContextTag(ContextTag::TAG_SETUP); - $sToken = SetupUtils::CreateSetupToken(); $oPage->add( << @@ -134,8 +133,8 @@ public function PreFormDisplay(SetupPage $oPage) - - + + From f2a5909b432d1e9fe72331ae397e7d43c861f864 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Fri, 29 May 2026 17:56:28 +0200 Subject: [PATCH 3/4] Setup fast track (keep current options) --- setup/wizardsteps/WizStepWelcome.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/setup/wizardsteps/WizStepWelcome.php b/setup/wizardsteps/WizStepWelcome.php index be2338c0ce..5658bc122a 100644 --- a/setup/wizardsteps/WizStepWelcome.php +++ b/setup/wizardsteps/WizStepWelcome.php @@ -120,15 +120,13 @@ public function Display(SetupPage $oPage): void * * @return void */ - public function PreFormDisplay(SetupPage $oPage) + public function PostFormDisplay(SetupPage $oPage) { if ($this->bCanMoveForward) { $sBuildConfigFile = APPCONF.ITOP_DEFAULT_ENV.'/'.ITOP_CONFIG_FILE; if (file_exists($sBuildConfigFile)) { $oPage->add( << - Fast track
@@ -137,14 +135,10 @@ public function PreFormDisplay(SetupPage $oPage)
- +
- -
- Normal track -
HTML ); } From 9f34e9a0dbc4be8b3a9daad2585c892cea714c02 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Mon, 1 Jun 2026 09:26:23 +0200 Subject: [PATCH 4/4] =?UTF-8?q?N=C2=B09455=20-=20Feature=20removal=20-=20c?= =?UTF-8?q?onsole=20screen=20behavior?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/wizardsteps/WizStepLandingBeforeAudit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/wizardsteps/WizStepLandingBeforeAudit.php b/setup/wizardsteps/WizStepLandingBeforeAudit.php index 7971b532c4..d35cad4296 100644 --- a/setup/wizardsteps/WizStepLandingBeforeAudit.php +++ b/setup/wizardsteps/WizStepLandingBeforeAudit.php @@ -21,7 +21,7 @@ public function __construct(WizardController $oWizard, $sCurrentState) $oWizard->SetParameter('datamodel_version', ITOP_CORE_VERSION); $oWizard->SetParameter('upgrade_type', 'use-compatible'); - $oWizard->SaveParameter('use_symbolic_links', MFCompiler::UseSymbolicLinks()); + $oWizard->SaveParameter('use_symbolic_links', MFCompiler::UseSymbolicLinks() ? 'on' : 'off'); $oWizard->SaveParameter('force-uninstall', ''); // should be done at the end