Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup/backup.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ protected function DBConnect()
$sPwd = $oConfig->Get('db_pwd');
$sSource = $oConfig->Get('db_name');
$sTlsEnabled = $oConfig->Get('db_tls.enabled');
$sTlsCA = $oConfig->Get('db_tls.ca');
$sTlsCA = $oConfig->Get('db_tls.ca') ?? '';

try {
$oMysqli = CMDBSource::GetMysqliInstance(
Expand Down
2 changes: 1 addition & 1 deletion setup/setuputils.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ public static function AsyncCheckDB($oPage, $aParameters)
// Unsupported Password, warn the user
$oPage->add_ready_script(
<<<JS
$("#db_info").html('<div class="message message-error"><span class="message-title">Error:</span>On Windows, the backup won\'t work because database password contains %, ! or &quot; character</div>');
$("#db_info").html('<div class="message message-error ibo-is-html-content"><span class="message-title">Error:</span>On Windows, the backup won\'t work because database password contains %, ! or &quot; character</div>');
JS
);
} else {
Expand Down
2 changes: 1 addition & 1 deletion setup/unattended-install/unattended-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function PrintUsageAndExit()
$aDBXmlSettings ['prefix'] = $oConfig->Get('db_subname');
$aDBXmlSettings ['db_tls_enabled'] = $oConfig->Get('db_tls.enabled');
//cannot be null or infinite loop triggered!
$aDBXmlSettings ['db_tls_ca'] = $oConfig->Get('db_tls.ca') ?? "";
$aDBXmlSettings ['db_tls_ca'] = $oConfig->Get('db_tls.ca') ?? '';
$oParams->Set('database', $aDBXmlSettings);

$aFields = [
Expand Down
58 changes: 56 additions & 2 deletions setup/wizardsteps/WizStepDetectedInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU Affero General Public License
*/

use Combodo\iTop\Application\WebPage\WebPage;

/**
Expand Down Expand Up @@ -205,7 +206,7 @@ public function Display(SetupPage $oPage): void
$sUpgradeDMVersionToDisplay = utils::HtmlEntities($sUpgradeDMVersion);
$oPage->add(
<<<HTML
<div class="message message-valid">The datamodel will be upgraded from version $sInstalledDataModelVersion to version $sUpgradeDMVersion.</div>
<div class="message message-valid ibo-is-html-content">The datamodel will be upgraded from version $sInstalledDataModelVersion to version $sUpgradeDMVersion.</div>
<input type="hidden" name="upgrade_type" value="use-compatible">
<input type="hidden" name="datamodel_path" value="$sCompatibleDMDirToDisplay">
<input type="hidden" name="datamodel_version" value="$sUpgradeDMVersionToDisplay">
Expand All @@ -214,15 +215,59 @@ public function Display(SetupPage $oPage): void

}

$oPage->add('<div id="db_info"></div>');

$sDBServer = json_encode($this->oWizard->GetParameter('db_server', ''));
$sDBUser = json_encode($this->oWizard->GetParameter('db_user', ''));
$sDBPwd = json_encode($this->oWizard->GetParameter('db_pwd', ''));
$sDBName = json_encode($this->oWizard->GetParameter('db_name', ''));
$sTlsCA = json_encode($this->oWizard->GetParameter('db_tls_ca', ''));
$sTlsEnabled = $this->oWizard->GetParameter('db_tls_enabled', false) ? 1 : 0;

$oPage->add_ready_script(
<<<EOF
$("#changes_summary .title").on('click', function() { $(this).parent().toggleClass('closed'); } );
$('input[name=upgrade_type]').on('click change', function() { WizardUpdateButtons(); });

var iCheckDBTimer = null;
var oXHRCheckDB = null;

function CheckDBConnection()
{
// Don't call the server too often...
if (iCheckDBTimer !== null)
{
clearTimeout(iCheckDBTimer);
iCheckDBTimer = null;
}
iCheckDBTimer = setTimeout(DoCheckDBConnection, 500);
}

function DoCheckDBConnection()
{
iCheckDBTimer = null;
var oParams = {
'db_server': $sDBServer,
'db_user': $sDBUser,
'db_pwd': $sDBPwd,
'db_name': $sDBName,
'db_tls_enabled': $sTlsEnabled,
'db_tls_ca': $sTlsCA,
}
Comment thread
eespie marked this conversation as resolved.
if ((oXHRCheckDB != null) && (oXHRCheckDB != undefined))
{
oXHRCheckDB.abort();
oXHRCheckDB = null;
}
oXHRCheckDB = WizardAsyncAction("check_db", oParams);
}

DoCheckDBConnection(); // Validate the initial values immediately
EOF
);

$oMutex = new iTopMutex(
'cron'.$this->oWizard->GetParameter('db_name', '').$this->oWizard->GetParameter('db_prefix', ''),
'cron'.$sDBName.$this->oWizard->GetParameter('db_prefix', ''),
$this->oWizard->GetParameter('db_server', ''),
$this->oWizard->GetParameter('db_user', ''),
$this->oWizard->GetParameter('db_pwd', ''),
Expand All @@ -235,6 +280,15 @@ public function Display(SetupPage $oPage): void
}
}

public function AsyncAction(WebPage $oPage, $sCode, $aParameters)
{
switch ($sCode) {
case 'check_db':
SetupUtils::AsyncCheckDB($oPage, $aParameters);
break;
}
}

public function CanMoveForward()
{
return $this->bCanMoveForward;
Expand Down
216 changes: 0 additions & 216 deletions setup/wizardsteps/WizStepInstallOrUpgrade.php

This file was deleted.

1 change: 0 additions & 1 deletion setup/wizardsteps/WizStepModulesChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ public function GetWizardSteps(): array
{
$aSteps = [
["class" => "WizStepWelcome","state" => ""],
["class" => "WizStepInstallOrUpgrade","state" => ""],
["class" => "WizStepDetectedInfo","state" => ""],
["class" => "WizStepUpgradeMiscParams","state" => ""],
];
Expand Down
Loading