Merge remote-tracking branch 'origin/support/3.0' into support/3.1

Most of the conflicts are caused by HU translations (N°7077 / #584)

# Conflicts:
#	css/setup.css
#	datamodels/2.x/authent-cas/dictionaries/hu.dict.authent-cas.php
#	datamodels/2.x/authent-ldap/dictionaries/hu.dict.authent-ldap.php
#	datamodels/2.x/authent-local/dictionaries/hu.dict.authent-local.php
#	datamodels/2.x/combodo-backoffice-darkmoon-theme/dictionaries/hu.dict.combodo-backoffice-darkmoon-theme.php
#	datamodels/2.x/combodo-db-tools/dictionaries/hu.dict.combodo-db-tools.php
#	datamodels/2.x/itop-attachments/dictionaries/hu.dict.itop-attachments.php
#	datamodels/2.x/itop-backup/dictionaries/hu.dict.itop-backup.php
#	datamodels/2.x/itop-bridge-cmdb-ticket/dictionaries/hu.dict.itop-bridge-cmdb-ticket.php
#	datamodels/2.x/itop-change-mgmt-itil/dictionaries/hu.dict.itop-change-mgmt-itil.php
#	datamodels/2.x/itop-change-mgmt/dictionaries/hu.dict.itop-change-mgmt.php
#	datamodels/2.x/itop-config-mgmt/dictionaries/hu.dict.itop-config-mgmt.php
#	datamodels/2.x/itop-config/dictionaries/hu.dict.itop-config.php
#	datamodels/2.x/itop-core-update/dictionaries/hu.dict.itop-core-update.php
#	datamodels/2.x/itop-faq-light/dictionaries/hu.dict.itop-faq-light.php
#	datamodels/2.x/itop-hub-connector/dictionaries/hu.dict.itop-hub-connector.php
#	datamodels/2.x/itop-incident-mgmt-itil/dictionaries/hu.dict.itop-incident-mgmt-itil.php
#	datamodels/2.x/itop-knownerror-mgmt/dictionaries/hu.dict.itop-knownerror-mgmt.php
#	datamodels/2.x/itop-oauth-client/hu.dict.itop-oauth-client.php
#	datamodels/2.x/itop-portal-base/dictionaries/hu.dict.itop-portal-base.php
#	datamodels/2.x/itop-portal/dictionaries/hu.dict.itop-portal.php
#	datamodels/2.x/itop-problem-mgmt/dictionaries/hu.dict.itop-problem-mgmt.php
#	datamodels/2.x/itop-request-mgmt-itil/dictionaries/hu.dict.itop-request-mgmt-itil.php
#	datamodels/2.x/itop-request-mgmt/dictionaries/hu.dict.itop-request-mgmt.php
#	datamodels/2.x/itop-service-mgmt-provider/dictionaries/hu.dict.itop-service-mgmt-provider.php
#	datamodels/2.x/itop-service-mgmt/dictionaries/hu.dict.itop-service-mgmt.php
#	datamodels/2.x/itop-structure/dictionaries/hu.dict.itop-structure.php
#	datamodels/2.x/itop-tickets/dictionaries/hu.dict.itop-tickets.php
#	dictionaries/hu.dictionary.itop.core.php
#	dictionaries/hu.dictionary.itop.ui.php
#	dictionaries/ui/components/breadcrumbs/hu.dictionary.itop.breadcrumbs.php
#	dictionaries/ui/components/datatable/hu.dictionary.itop.datatable.php
#	dictionaries/ui/components/field/hu.dictionary.itop.field.php
#	dictionaries/ui/components/global-search/hu.dictionary.itop.global-search.php
#	dictionaries/ui/components/input/hu.dictionary.itop.input.php
#	dictionaries/ui/components/quick-create/hu.dictionary.itop.quick-create.php
#	dictionaries/ui/layouts/activity-panel/hu.dictionary.itop.activity-panel.php
#	dictionaries/ui/layouts/navigation-menu/hu.dictionary.itop.navigation-menu.php
#	dictionaries/ui/layouts/object-details/hu.dictionary.itop.object-details.php
#	dictionaries/ui/layouts/page-content/hu.dictionary.itop.page-content.php
#	dictionaries/ui/layouts/tab-container/hu.dictionary.itop.tab-container.php
#	dictionaries/ui/pages/errorpage/hu.dictionary.itop.errorpage.php
#	dictionaries/ui/pages/preferences/hu.dictionary.itop.preferences.php
#	tests/php-unit-tests/unitary-tests/setup/DBBackupTest.php
This commit is contained in:
Pierre Goiffon
2024-01-03 15:25:10 +01:00
41 changed files with 1547 additions and 1479 deletions

View File

@@ -356,9 +356,8 @@ class DBBackup
// Store the results in a temporary file
$sTmpFileName = self::EscapeShellArg($sBackupFileName);
$sPortOption = self::GetMysqliCliSingleOption('port', $this->iDBPort);
$sPortAndTransportOptions = self::GetMysqlCliPortAndTransportOptions($this->sDBHost, $this->iDBPort);
$sTlsOptions = self::GetMysqlCliTlsOptions($this->oConfig);
$sProtocolOption = self::GetMysqlCliTransportOption($this->sDBHost);
$sMysqlVersion = CMDBSource::GetDBVersion();
$bIsMysqlSupportUtf8mb4 = (version_compare($sMysqlVersion, self::MYSQL_VERSION_WITH_UTF8MB4_IN_PROGRAMS) === -1);
@@ -377,10 +376,10 @@ EOF;
chmod($sMySQLDumpCnfFile, 0600);
file_put_contents($sMySQLDumpCnfFile, $sMySQLDumpCnf, LOCK_EX);
// Note: opt implicitely sets lock-tables... which cancels the benefit of single-transaction!
// Note: opt implicitly sets lock-tables... which cancels the benefit of single-transaction!
// skip-lock-tables compensates and allows for writes during a backup
$sCommand = "$sMySQLDump --defaults-extra-file=\"$sMySQLDumpCnfFile\" --opt --skip-lock-tables --default-character-set=".$sMysqldumpCharset." --add-drop-database --single-transaction --host=$sHost $sPortOption $sProtocolOption --user=$sUser $sTlsOptions --result-file=$sTmpFileName $sDBName $sTables 2>&1";
$sCommandDisplay = "$sMySQLDump --defaults-extra-file=\"$sMySQLDumpCnfFile\" --opt --skip-lock-tables --default-character-set=".$sMysqldumpCharset." --add-drop-database --single-transaction --host=$sHost $sPortOption $sProtocolOption --user=xxxxx $sTlsOptions --result-file=$sTmpFileName $sDBName $sTables";
$sCommand = "$sMySQLDump --defaults-extra-file=\"$sMySQLDumpCnfFile\" --opt --skip-lock-tables --default-character-set=" . $sMysqldumpCharset . " --add-drop-database --single-transaction --host=$sHost $sPortAndTransportOptions --user=$sUser $sTlsOptions --result-file=$sTmpFileName $sDBName $sTables 2>&1";
$sCommandDisplay = "$sMySQLDump --defaults-extra-file=\"$sMySQLDumpCnfFile\" --opt --skip-lock-tables --default-character-set=" . $sMysqldumpCharset . " --add-drop-database --single-transaction --host=$sHost $sPortAndTransportOptions --user=xxxxx $sTlsOptions --result-file=$sTmpFileName $sDBName $sTables";
// Now run the command for real
$this->LogInfo("backup: generate data file with command: $sCommandDisplay");
@@ -578,25 +577,37 @@ EOF;
}
/**
* Define if we should force a transport option
*
* @param string $sHost
* @return string CLI options for port and protocol
*
* @return string .
* @since 2.7.9 3.0.4 3.1.1 N°6123
* @since 2.7.9 3.0.4 3.1.1 N°6123 method creation
* @since 2.7.10 3.0.4 3.1.2 3.2.0 N°6889 rename method to return both port and transport options. Keep default socket connexion if we are on localhost with no port
*
* @link https://bugs.mysql.com/bug.php?id=55796 MySQL CLI tools will ignore `--port` option on localhost
* @link https://jira.mariadb.org/browse/MDEV-14974 Since 10.6.1 the MariaDB CLI tools will use the `--port` option on host=localhost
*/
public static function GetMysqlCliTransportOption(string $sHost)
private static function GetMysqlCliPortAndTransportOptions(string $sHost, ?int $iPort): string
{
$sTransportOptions = '';
/** N°6123 As we're using a --port option, if we use localhost as host,
* MariaDB > 10.6 will implicitly change its protocol from socket to tcp and throw a warning **/
if($sHost === 'localhost'){
$sTransportOptions = '--protocol=tcp';
if (strtolower($sHost) === 'localhost') {
/**
* Since MariaDB 10.6.1 if we have host=localhost, and only the --port option we will get a warning
* To avoid this warning if we want to set --port option we must set --protocol=tcp
**/
if (is_null($iPort)) {
// no port specified => no option to return, this will mean using socket protocol (unix socket)
return '';
}
$sPortOption = self::GetMysqliCliSingleOption('port', $iPort);
$sTransportOptions = ' --protocol=tcp';
return $sPortOption . $sTransportOptions;
}
return $sTransportOptions;
if (is_null($iPort)) {
$iPort = CMDBSource::MYSQL_DEFAULT_PORT;
}
$sPortOption = self::GetMysqliCliSingleOption('port', $iPort);
return $sPortOption;
}
/**