mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 22:48:45 +02:00
Merge remote-tracking branch 'origin/support/2.7' into develop
This commit is contained in:
@@ -1013,8 +1013,8 @@ class SetupUtils
|
||||
$oPage, $bIsItopInstall, $sDBServer, $sDBUser, $sDBPwd, $sDBName, $sDBPrefix, $bTlsEnabled, $sTlsCA,
|
||||
$sNewDBName = ''
|
||||
) {
|
||||
$sWikiVersion = utils::GetItopVersionWikiSyntax(); //eg : '2_7_0';
|
||||
$sMysqlTlsWikiPageUrl = 'https://wiki.openitop.org/doku.php?id='.$sWikiVersion.':install:php_and_mysql_tls';
|
||||
$sWikiVersion = utils::GetItopVersionWikiSyntax(); //eg : '2_7_0';
|
||||
$sMysqlTlsWikiPageUrl = 'https://www.itophub.io/wiki/page?id='.$sWikiVersion.':install:php_and_mysql_tls';
|
||||
|
||||
$oPage->add('<tr><td colspan="2">');
|
||||
$oPage->add('<fieldset><legend>Database Server Connection</legend>');
|
||||
@@ -1023,13 +1023,15 @@ class SetupUtils
|
||||
//-- DB connection params
|
||||
$oPage->add('<tbody>');
|
||||
$oPage->add('<tr><td>Server Name:</td><td><input id="db_server" type="text" name="db_server" value="'.htmlentities($sDBServer, ENT_QUOTES, 'UTF-8').'" size="15"/></td><td>E.g. "localhost", "dbserver.mycompany.com" or "192.142.10.23"</td></tr>');
|
||||
$oPage->add('<tr><td>Login:</td><td><input id="db_user" type="text" name="db_user" value="'.htmlentities($sDBUser, ENT_QUOTES, 'UTF-8').'" size="15"/></td><td rowspan="2" style="vertical-align:top">The account must have the following privileges on the database: SELECT, INSERT, UPDATE, DELETE, DROP, CREATE, ALTER, CREATE VIEW, SHOW VIEW, LOCK TABLE, SUPER, TRIGGER</td></tr>');
|
||||
$oPage->add('<tr><td>Login:</td><td><input id="db_user" type="text" name="db_user" value="'
|
||||
.htmlentities($sDBUser, ENT_QUOTES, 'UTF-8')
|
||||
.'" size="15"/></td><td rowspan="2" style="vertical-align:top">The account must have the following privileges on the database: SELECT, INSERT, UPDATE, DELETE, DROP, CREATE, ALTER, CREATE VIEW, SHOW VIEW, LOCK TABLE, SUPER, TRIGGER</td></tr>');
|
||||
$oPage->add('<tr><td>Password:</td><td><input id="db_pwd" autocomplete="off" type="password" name="db_pwd" value="'.htmlentities($sDBPwd, ENT_QUOTES, 'UTF-8').'" size="15"/></td></tr>');
|
||||
$oPage->add('</tbody>');
|
||||
|
||||
//-- TLS params (N°1260)
|
||||
$sTlsEnabledChecked = $bTlsEnabled ? ' checked' : '';
|
||||
$sTlsCaDisabled = $bTlsEnabled ? '' : ' disabled';
|
||||
$sTlsCaDisabled = $bTlsEnabled ? '' : ' disabled';
|
||||
$oPage->add('<tbody id="tls_options" class="collapsable-options">');
|
||||
$oPage->add('<tr><th colspan="3" style="text-align: left; background-color: transparent"><label style="margin: 6em; font-weight: normal; color: #696969"><img style="vertical-align:bottom" id="db_tls_img">Use TLS encrypted connection</label></th></tr>');
|
||||
$oPage->add('<tr style="display:none"><td colspan="3" class="message message-error">Before configuring MySQL with TLS encryption, read the documentation <a href="'.$sMysqlTlsWikiPageUrl.'" target="_blank">on Combodo\'s Wiki</a></td></tr>');
|
||||
@@ -1273,39 +1275,38 @@ EOF
|
||||
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "Info - User privileges: ".($oDBSource->GetRawPrivileges()));
|
||||
|
||||
$bHasDbVersionRequired = self::CheckDbServerVersion($aResult, $oDBSource);
|
||||
if (!$bHasDbVersionRequired)
|
||||
{
|
||||
if (!$bHasDbVersionRequired) {
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
// Check some server variables
|
||||
$iMaxAllowedPacket = $oDBSource->GetServerVariable('max_allowed_packet');
|
||||
$iMaxUploadSize = utils::ConvertToBytes(ini_get('upload_max_filesize'));
|
||||
$iMaxAllowedPacket = $oDBSource->GetServerVariable('max_allowed_packet');
|
||||
$sMaxAllowedPacketFriendly = utils::BytesToFriendlyFormat($iMaxAllowedPacket);
|
||||
$iMaxUploadSize = utils::ConvertToBytes(ini_get('upload_max_filesize'));
|
||||
$sMaxUploadSizeFriendly = utils::BytesToFriendlyFormat($iMaxUploadSize);
|
||||
if ($iMaxAllowedPacket >= (500 + $iMaxUploadSize)) // Allow some space for the query + the file to upload
|
||||
{
|
||||
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_allowed_packet ($iMaxAllowedPacket) is big enough compared to upload_max_filesize ($iMaxUploadSize).");
|
||||
}
|
||||
else if($iMaxAllowedPacket < $iMaxUploadSize)
|
||||
{
|
||||
$aResult['checks'][] = new CheckResult(CheckResult::WARNING, "MySQL server's max_allowed_packet ($iMaxAllowedPacket) is not big enough. Please, consider setting it to at least ".(500 + $iMaxUploadSize).".");
|
||||
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_allowed_packet ($sMaxAllowedPacketFriendly) is big enough compared to upload_max_filesize ($sMaxUploadSizeFriendly).");
|
||||
} else if ($iMaxAllowedPacket < $iMaxUploadSize) {
|
||||
$sWikiVersion = utils::GetItopVersionWikiSyntax(); //eg : '2_7_0';
|
||||
$sAttachmentsVarsWikiPageUrl = 'https://www.itophub.io/wiki/page?id='.$sWikiVersion
|
||||
.':install:php_and_mysql_configuration#attachments_upload';
|
||||
|
||||
$aResult['checks'][] = new CheckResult(CheckResult::WARNING,
|
||||
"MySQL server's max_allowed_packet ($sMaxAllowedPacketFriendly) is not big enough compared to upload_max_filesize ($sMaxUploadSizeFriendly), whereas it should has a greater value. Consider increasing its value of at least 500KB. See the <a href=\"$sAttachmentsVarsWikiPageUrl\">documentation</a> for details.");
|
||||
}
|
||||
|
||||
$iMaxConnections = $oDBSource->GetServerVariable('max_connections');
|
||||
if ($iMaxConnections < 5)
|
||||
{
|
||||
if ($iMaxConnections < 5) {
|
||||
$aResult['checks'][] = new CheckResult(CheckResult::WARNING, "MySQL server's max_connections ($iMaxConnections) is not enough. Please, consider setting it to at least 5.");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$aResult['checks'][] = new CheckResult(CheckResult::INFO, "MySQL server's max_connections is set to $iMaxConnections.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
$aResult['databases'] = $oDBSource->ListDB();
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
catch (Exception $e) {
|
||||
$aResult['databases'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user