[wp-trac] [WordPress Trac] #58816: MariaDB 11.x: deprecated alias for MySQL
WordPress Trac
noreply at wordpress.org
Tue Jul 18 14:58:33 UTC 2023
#58816: MariaDB 11.x: deprecated alias for MySQL
------------------------------+-----------------------
Reporter: JavierCasares | Owner: (none)
Type: defect (bug) | Status: reopened
Priority: normal | Milestone:
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
------------------------------+-----------------------
Changes (by JavierCasares):
* status: closed => reopened
* resolution: invalid =>
Comment:
The Test-Runners calls "mysql --version" to get the MySQL version with a
shell command.
The idea (I'm trying but doedn't get to work) is to change this shell
question, to a "SELECT VERSION()".
As now (in a future) "mysql" doesn't works with "mariadb", we get the
message as the alias won't work.
MariaDB 11.0 is checking the alias as "future deprecation" to stop using
mysql as an alias. And in 1-2 versions it won't work, so we cannot get the
SQL version from the shell command because will be tow separated programs
(mysql and mariadb). The best way is to connect to the database and do a
"SELECT VERSION()".
I've tried this function:
{{{#!php
<?php
/**
* Get SQL version
*/
function get_sql_version() {
$database_version = null;
$conn = new mysqli( getenv( 'WPT_DB_HOST' ), getenv( 'WPT_DB_USER' ),
getenv( 'WPT_DB_PASSWORD' ), getenv( 'WPT_DB_NAME' ) );
if ( !$conn->connect_error ) {
$result = $conn->query( 'SELECT VERSION()' );
if ( $result->num_rows > 0 ) {
$row = $result->fetch_assoc();
$database_version = $row['VERSION()'];
}
}
$conn->close();
return trim( (string) $database_version );
}
}}}
and changing...
{{{#!php
<?php
'mysql_version' => get_sql_version(),
}}}
But I cannot get that working (probably I'm doing something wrong testing
it. I'm not expert with node and the testing part.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58816#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list