From 6be9255ca0d5a3ea9476f9b6353be0b698f08c4a Mon Sep 17 00:00:00 2001 From: Timmy38 <101416770+Timmy38@users.noreply.github.com> Date: Fri, 19 Sep 2025 10:53:58 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B07071=20-=20Remove=20CMDBSource::MYSQL=5F?= =?UTF-8?q?DEFAULT=5FPORT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/cmdbsource.class.inc.php | 7 +------ setup/backup.class.inc.php | 2 +- tests/php-unit-tests/unitary-tests/setup/DBBackupTest.php | 8 ++++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/core/cmdbsource.class.inc.php b/core/cmdbsource.class.inc.php index 6d70b12fb..0323d34e7 100644 --- a/core/cmdbsource.class.inc.php +++ b/core/cmdbsource.class.inc.php @@ -42,11 +42,6 @@ class CMDBSource const ENUM_DB_VENDOR_MARIADB = 'MariaDB'; const ENUM_DB_VENDOR_PERCONA = 'Percona'; - /** - * @since 2.7.10 3.0.4 3.1.2 3.0.2 N°6889 constant creation - * @internal will be removed in a future version - */ - const MYSQL_DEFAULT_PORT = 3306; /** * Error: 1205 SQLSTATE: HY000 (ER_LOCK_WAIT_TIMEOUT) @@ -220,7 +215,7 @@ class CMDBSource * @param string $sServer server variable to update * @param int|null $iPort port variable to update, will return null if nothing is specified in $sDbHost * - * @since 2.7.10 3.0.4 3.1.2 3.2.0 N°6889 will return null in $iPort if port isn't present in $sDbHost. Use {@see MYSQL_DEFAULT_PORT} if needed + * @since 2.7.10 3.0.4 3.1.2 3.2.0 N°6889 will return null in $iPort if port isn't present in $sDbHost. * * @link http://php.net/manual/en/mysqli.persistconns.php documentation for the "p:" prefix (persistent connexion) */ diff --git a/setup/backup.class.inc.php b/setup/backup.class.inc.php index 896bf1c8f..3d02e0ebe 100644 --- a/setup/backup.class.inc.php +++ b/setup/backup.class.inc.php @@ -617,7 +617,7 @@ EOF; } if (is_null($iPort)) { - $iPort = CMDBSource::MYSQL_DEFAULT_PORT; + return ''; } $sPortOption = self::GetMysqliCliSingleOption('port', $iPort); diff --git a/tests/php-unit-tests/unitary-tests/setup/DBBackupTest.php b/tests/php-unit-tests/unitary-tests/setup/DBBackupTest.php index 39569086b..a998a65f0 100644 --- a/tests/php-unit-tests/unitary-tests/setup/DBBackupTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/DBBackupTest.php @@ -130,16 +130,16 @@ class DBBackupTest extends ItopTestCase 'Localhost with port' => ['localhost', $iTestPort, $iTestPort, ' --protocol=tcp'], // we want both port and protocol for 127.0.0.1, because it is an ip address so using tcp/ip stack ! - '127.0.0.1 no port' => ['127.0.0.1', null, $iDefaultPort, ''], + '127.0.0.1 no port' => ['127.0.0.1', null, null, ''], '127.0.0.1 with port' => ['127.0.0.1', $iTestPort, $iTestPort, ''], - 'IP no port' => ['192.168.1.15', null, $iDefaultPort, ''], + 'IP no port' => ['192.168.1.15', null, null, ''], 'IP with port' => ['192.168.1.15', $iTestPort, $iTestPort, ''], - 'DNS no port' => ['dbserver.mycompany.com', null, $iDefaultPort, ''], + 'DNS no port' => ['dbserver.mycompany.com', null, null, ''], 'DNS with port' => ['dbserver.mycompany.com', $iTestPort, $iTestPort, ''], - 'Windows name no port' => ['dbserver', null, $iDefaultPort, ''], + 'Windows name no port' => ['dbserver', null, null, ''], 'Windows name with port' => ['dbserver', $iTestPort, $iTestPort, ''], ]; }