Refactor InnoDB methods for version handling

Removed the getInnodbPluginVersion method and updated the getInnodbFileFormat method to handle version checks for MariaDB and MySQL.

Signed-off-by: Guido Selva guido.selva@gmail.com
This commit is contained in:
GS 2026-03-31 17:39:04 +02:00 committed by GitHub
parent 04424694c3
commit 45fdf3123d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -281,18 +281,6 @@ class Innodb extends StorageEngine
return 'innodb-storage-engine';
}
/**
* Gets the InnoDB plugin version number
*
* @return string the version number, or empty if not running as a plugin
*/
public function getInnodbPluginVersion()
{
global $dbi;
return $dbi->fetchValue('SELECT @@innodb_version;') ?: '';
}
/**
* Gets the InnoDB file format
*
@ -300,19 +288,14 @@ class Innodb extends StorageEngine
*
* @return string|null the InnoDB file format
*/
public function getInnodbFileFormat(): ?string
public function getInnodbFileFormat(): string|null
{
global $dbi;
$value = $dbi->fetchValue("SHOW GLOBAL VARIABLES LIKE 'innodb_file_format';", 1);
if ($value === false) {
// This variable does not exist anymore on MariaDB >= 10.6.0
// This variable does not exist anymore on MySQL >= 8.0.0
return null;
}
return (string) $value;
return (
($dbi->isMariaDB() && $dbi->getVersion() >= 100600)
|| ($dbi->isMySql() && $dbi->getVersion() >= 80000)
) ? '' : $dbi->fetchValue("SELECT @@innodb_file_format;");
}
/**