Remove connection parameter from getClientInfo

Related to #16911

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2021-10-28 13:53:15 -03:00
parent 9dcfc13ac4
commit 7bcccf7bdc
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
7 changed files with 9 additions and 32 deletions

View File

@ -2133,17 +2133,11 @@ class DatabaseInterface implements DbalInterface
/**
* returns a string that represents the client library version
*
* @param int $link link type
*
* @return string MySQL client library version
*/
public function getClientInfo($link = self::CONNECT_USER): string
public function getClientInfo(): string
{
if (! isset($this->links[$link])) {
return '';
}
return $this->extension->getClientInfo($this->links[$link]);
return $this->extension->getClientInfo();
}
/**

View File

@ -621,11 +621,9 @@ interface DbalInterface
/**
* returns a string that represents the client library version
*
* @param int $link link type
*
* @return string MySQL client library version
*/
public function getClientInfo($link = DatabaseInterface::CONNECT_USER): string;
public function getClientInfo(): string;
/**
* returns last error message or false if no errors occurred

View File

@ -146,11 +146,9 @@ interface DbiExtension
/**
* returns a string that represents the client library version
*
* @param object $link mysql link
*
* @return string MySQL client library version
*/
public function getClientInfo($link);
public function getClientInfo();
/**
* returns last error message or false if no errors occurred

View File

@ -74,7 +74,6 @@ use function is_bool;
use function mysqli_init;
use function stripos;
use function trigger_error;
use const PHP_VERSION_ID;
use function mysqli_get_client_info;
/**
@ -393,11 +392,9 @@ class DbiMysqli implements DbiExtension
/**
* returns a string that represents the client library version
*
* @param mysqli $mysqli mysql link
*
* @return string MySQL client library version
*/
public function getClientInfo($mysqli)
public function getClientInfo()
{
return mysqli_get_client_info();
}

View File

@ -33,10 +33,9 @@ class DbiDummyTest extends AbstractTestCase
public function testGetClientInfo(): void
{
$obj = (object) [];
$this->assertNotEmpty($this->object->getClientInfo($obj));
$this->assertNotEmpty($this->object->getClientInfo());
// Call the DatabaseInterface
$this->assertSame($GLOBALS['dbi']->getClientInfo(), $this->object->getClientInfo($obj));
$this->assertSame($GLOBALS['dbi']->getClientInfo(), $this->object->getClientInfo());
}
/**

View File

@ -11,7 +11,6 @@ use PhpMyAdmin\Tests\AbstractTestCase;
use const MYSQLI_ASSOC;
use const MYSQLI_BOTH;
use const MYSQLI_NUM;
use const PHP_VERSION_ID;
class DbiMysqliTest extends AbstractTestCase
{
@ -32,13 +31,7 @@ class DbiMysqliTest extends AbstractTestCase
public function testGetClientInfo(): void
{
if (PHP_VERSION_ID < 80100) {
$this->markTestSkipped('This test requires PHP 8.1');
}
/** @var mysqli $obj */
$obj = null;
$this->assertNotEmpty($this->object->getClientInfo($obj));
$this->assertNotEmpty($this->object->getClientInfo());
}
/**

View File

@ -354,11 +354,9 @@ class DbiDummy implements DbiExtension
/**
* returns a string that represents the client library version
*
* @param object $link connection link
*
* @return string MySQL client library version
*/
public function getClientInfo($link)
public function getClientInfo()
{
return 'libmysql - mysqlnd x.x.x-dev (phpMyAdmin tests)';
}