mirror of
https://github.com/Combodo/iTop.git
synced 2026-06-12 10:52:20 +02:00
Compare commits
4 Commits
develop
...
feature/un
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f34e9a0db | ||
|
|
f2a5909b43 | ||
|
|
1aa249b59f | ||
|
|
6f34a4799c |
@@ -123,6 +123,7 @@ require_once('./xmldataloader.class.inc.php');
|
|||||||
// Never cache this page
|
// Never cache this page
|
||||||
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||||
header("Expires: Fri, 17 Jul 1970 05:00:00 GMT"); // Date in the past
|
header("Expires: Fri, 17 Jul 1970 05:00:00 GMT"); // Date in the past
|
||||||
|
$oCtx = new ContextTag(ContextTag::TAG_SETUP);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main program
|
* Main program
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ if (!function_exists('json_decode')) {
|
|||||||
//N°3671 setup context: force $bForceTrustProxy to be persisted in next calls
|
//N°3671 setup context: force $bForceTrustProxy to be persisted in next calls
|
||||||
utils::GetAbsoluteUrlAppRoot(true);
|
utils::GetAbsoluteUrlAppRoot(true);
|
||||||
$oWizard = new WizardController('WizStepWelcome');
|
$oWizard = new WizardController('WizStepWelcome');
|
||||||
|
$oCtx = new ContextTag(ContextTag::TAG_SETUP);
|
||||||
//N°3952
|
//N°3952
|
||||||
if (SetupUtils::IsSessionSetupTokenValid()) {
|
if (SetupUtils::IsSessionSetupTokenValid()) {
|
||||||
// Normal operation
|
// Normal operation
|
||||||
@@ -69,5 +70,5 @@ if (SetupUtils::IsSessionSetupTokenValid()) {
|
|||||||
SetupUtils::ExitMaintenanceMode(false);
|
SetupUtils::ExitMaintenanceMode(false);
|
||||||
// Force initializing the setup
|
// Force initializing the setup
|
||||||
$oWizard->Start();
|
$oWizard->Start();
|
||||||
SetupUtils::CreateSetupToken();
|
//SetupUtils::CreateSetupToken();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,6 +220,8 @@ HTML;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$oPage->LinkScriptFromAppRoot('setup/setup.js');
|
$oPage->LinkScriptFromAppRoot('setup/setup.js');
|
||||||
|
$oStep->PreFormDisplay($oPage);
|
||||||
|
|
||||||
$oPage->add('<form id="wiz_form" class="ibo-setup--wizard" method="post">');
|
$oPage->add('<form id="wiz_form" class="ibo-setup--wizard" method="post">');
|
||||||
$oPage->add('<div class="ibo-setup--wizard--content">');
|
$oPage->add('<div class="ibo-setup--wizard--content">');
|
||||||
$oStep->Display($oPage);
|
$oStep->Display($oPage);
|
||||||
@@ -283,8 +285,8 @@ EOF
|
|||||||
$oPage->output();
|
$oPage->output();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Make the wizard run: Start, Next or Back depending WizardUpdateButtons();
|
* Make the wizard run: 'Start', 'Next' or 'Back' depending WizardUpdateButtons();
|
||||||
on the page's parameters
|
* on the page's parameters
|
||||||
*/
|
*/
|
||||||
public function Run()
|
public function Run()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class WizStepLandingBeforeAudit extends WizStepModulesChoice
|
|||||||
$oWizard->SetParameter('datamodel_version', ITOP_CORE_VERSION);
|
$oWizard->SetParameter('datamodel_version', ITOP_CORE_VERSION);
|
||||||
$oWizard->SetParameter('upgrade_type', 'use-compatible');
|
$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', '');
|
$oWizard->SaveParameter('force-uninstall', '');
|
||||||
|
|
||||||
// should be done at the end
|
// should be done at the end
|
||||||
@@ -40,8 +40,8 @@ class WizStepLandingBeforeAudit extends WizStepModulesChoice
|
|||||||
*/
|
*/
|
||||||
public function UpdateWizardStateAndGetNextStep($bMoveForward = true): WizardState
|
public function UpdateWizardStateAndGetNextStep($bMoveForward = true): WizardState
|
||||||
{
|
{
|
||||||
$oProductionEnv = new RunTimeEnvironment();
|
$oRuntimeEnv = new RunTimeEnvironment();
|
||||||
$sBuildConfigFile = APPCONF.$oProductionEnv->GetBuildEnv().'/'.ITOP_CONFIG_FILE;
|
$sBuildConfigFile = APPCONF.$oRuntimeEnv->GetBuildEnv().'/'.ITOP_CONFIG_FILE;
|
||||||
@chmod($sBuildConfigFile, 0770); // In case it exists: RWX for owner and group, nothing for others
|
@chmod($sBuildConfigFile, 0770); // In case it exists: RWX for owner and group, nothing for others
|
||||||
|
|
||||||
$oConfig = new Config($sBuildConfigFile);
|
$oConfig = new Config($sBuildConfigFile);
|
||||||
@@ -56,6 +56,14 @@ class WizStepLandingBeforeAudit extends WizStepModulesChoice
|
|||||||
$this->oWizard->SetParameter('display_choices', '[]');
|
$this->oWizard->SetParameter('display_choices', '[]');
|
||||||
$this->oWizard->SetParameter('extensions_not_uninstallable', '[]');
|
$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();
|
$aWizardSteps = $this->GetWizardSteps();
|
||||||
$this->oWizard->SetWizardSteps($aWizardSteps);
|
$this->oWizard->SetWizardSteps($aWizardSteps);
|
||||||
$this->sCurrentState = count($aWizardSteps) - 1;
|
$this->sCurrentState = count($aWizardSteps) - 1;
|
||||||
|
|||||||
@@ -18,14 +18,23 @@
|
|||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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
|
* First step of the iTop Installation Wizard: Welcome screen, requirements
|
||||||
*/
|
*/
|
||||||
class WizStepWelcome extends WizardStep
|
class WizStepWelcome extends WizardStep
|
||||||
{
|
{
|
||||||
protected $bCanMoveForward;
|
protected $bCanMoveForward;
|
||||||
|
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()
|
public function GetTitle()
|
||||||
{
|
{
|
||||||
@@ -48,8 +57,7 @@ class WizStepWelcome extends WizardStep
|
|||||||
|
|
||||||
public function UpdateWizardStateAndGetNextStep($bMoveForward = true): WizardState
|
public function UpdateWizardStateAndGetNextStep($bMoveForward = true): WizardState
|
||||||
{
|
{
|
||||||
$sUID = SetupUtils::CreateSetupToken();
|
$this->oWizard->SetParameter('authent', $this->sUID);
|
||||||
$this->oWizard->SetParameter('authent', $sUID);
|
|
||||||
return new WizardState(WizStepInstallOrUpgrade::class);
|
return new WizardState(WizStepInstallOrUpgrade::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,39 +78,14 @@ class WizStepWelcome extends WizardStep
|
|||||||
EOF
|
EOF
|
||||||
);
|
);
|
||||||
$oPage->add('<h1>'.ITOP_APPLICATION.' Installation Wizard</h1>');
|
$oPage->add('<h1>'.ITOP_APPLICATION.' Installation Wizard</h1>');
|
||||||
$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;"';
|
$sStyle = 'style="display:none;overflow:auto;"';
|
||||||
$sToggleButtons = '<button type="button" id="show_details" class="ibo-button ibo-is-alternative ibo-is-neutral" onclick="$(\'#details\').toggle(); $(this).toggle(); $(\'#hide_details\').toggle();"><span class="ibo-button--icon fa fa-caret-down"></span><span class="ibo-button--label">Show details</span></button><button type="button" id="hide_details" class="ibo-button ibo-is-alternative ibo-is-neutral" style="display:none;" onclick="$(\'#details\').toggle(); $(this).toggle(); $(\'#show_details\').toggle();"><span class="ibo-button--icon fa fa-caret-up"></span><span class="ibo-button--label">Hide details</span></button>';
|
$sToggleButtons = '<button type="button" id="show_details" class="ibo-button ibo-is-alternative ibo-is-neutral" onclick="$(\'#details\').toggle(); $(this).toggle(); $(\'#hide_details\').toggle();"><span class="ibo-button--icon fa fa-caret-down"></span><span class="ibo-button--label">Show details</span></button><button type="button" id="hide_details" class="ibo-button ibo-is-alternative ibo-is-neutral" style="display:none;" onclick="$(\'#details\').toggle(); $(this).toggle(); $(\'#show_details\').toggle();"><span class="ibo-button--icon fa fa-caret-up"></span><span class="ibo-button--label">Hide details</span></button>';
|
||||||
if (count($aErrors) > 0) {
|
if (count($this->aErrors) > 0) {
|
||||||
$sStyle = 'overflow:auto;"';
|
$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';
|
$sH2Class = 'text-error';
|
||||||
} elseif (count($aWarnings) > 0) {
|
} elseif (count($this->aWarnings) > 0) {
|
||||||
$sTitle = count($aWarnings).' Warning(s) '.$sToggleButtons;
|
$sTitle = count($this->aWarnings).' Warning(s) '.$sToggleButtons;
|
||||||
$sH2Class = 'text-warning';
|
$sH2Class = 'text-warning';
|
||||||
} else {
|
} else {
|
||||||
$sTitle = 'Ok. '.$sToggleButtons;
|
$sTitle = 'Ok. '.$sToggleButtons;
|
||||||
@@ -114,13 +97,13 @@ EOF
|
|||||||
<div id="details" $sStyle>
|
<div id="details" $sStyle>
|
||||||
HTML
|
HTML
|
||||||
);
|
);
|
||||||
foreach ($aErrors as $sText) {
|
foreach ($this->aErrors as $sText) {
|
||||||
$oPage->error($sText);
|
$oPage->error($sText);
|
||||||
}
|
}
|
||||||
foreach ($aWarnings as $sText) {
|
foreach ($this->aWarnings as $sText) {
|
||||||
$oPage->warning($sText);
|
$oPage->warning($sText);
|
||||||
}
|
}
|
||||||
foreach ($aInfo as $sText) {
|
foreach ($this->aInfo as $sText) {
|
||||||
$oPage->ok($sText);
|
$oPage->ok($sText);
|
||||||
}
|
}
|
||||||
$oPage->add('</div>');
|
$oPage->add('</div>');
|
||||||
@@ -131,8 +114,70 @@ HTML
|
|||||||
$oPage->add_ready_script('CheckDirectoryConfFilesPermissions("'.utils::GetItopVersionWikiSyntax().'")');
|
$oPage->add_ready_script('CheckDirectoryConfFilesPermissions("'.utils::GetItopVersionWikiSyntax().'")');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add post display stuff to the setup screen
|
||||||
|
* @param \SetupPage $oPage
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function PostFormDisplay(SetupPage $oPage)
|
||||||
|
{
|
||||||
|
if ($this->bCanMoveForward) {
|
||||||
|
$sBuildConfigFile = APPCONF.ITOP_DEFAULT_ENV.'/'.ITOP_CONFIG_FILE;
|
||||||
|
if (file_exists($sBuildConfigFile)) {
|
||||||
|
$oPage->add(
|
||||||
|
<<<HTML
|
||||||
|
<form method="post">
|
||||||
|
<input type="hidden" name="_class" value="WizStepLandingBeforeAudit"/>
|
||||||
|
<input type="hidden" name="operation" value="next"/>
|
||||||
|
<input type="hidden" name="_params[skip_wizard]" value="1"/>
|
||||||
|
<input type="hidden" name="authent" value="{$this->sUID}"/>
|
||||||
|
<input type="hidden" name="_params[authent]" value="{$this->sUID}"/>
|
||||||
|
<table style="width:100%;" class="ibo-setup--wizard--buttons-container">
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: right"><button type="submit" class="ibo-button ibo-is-regular ibo-is-secondary">Keep current choices</button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
HTML
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function CanMoveForward()
|
public function CanMoveForward()
|
||||||
{
|
{
|
||||||
return $this->bCanMoveForward;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,10 @@ abstract class WizardStep
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function PreFormDisplay(SetupPage $oPage)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected function CheckDependencies()
|
protected function CheckDependencies()
|
||||||
{
|
{
|
||||||
if (is_null($this->bDependencyCheck)) {
|
if (is_null($this->bDependencyCheck)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user