Skip to content

Commit

Permalink
Bug 1896055: Don't talk to MariaDB with the MySQL driver (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
justdave authored May 14, 2024
1 parent 30aa45b commit 7d38370
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 18 deletions.
38 changes: 20 additions & 18 deletions Bugzilla/DB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,23 @@ sub bz_check_server_version {

my $sql_vers = $self->bz_server_version;
if (((lc($db->{name}) eq 'mysql') || (lc($db->{name}) eq "mariadb"))
&& ($sql_vers =~ s/^5\.5\.5-//)) {
# Version 5.5.5 of MySQL never existed. MariaDB >= 10 always puts '5.5.5-'
&& ($sql_vers =~ s/^5\.5\.5-// || $sql_vers =~ /-MariaDB/)) {
# Version 5.5.5 of MySQL never existed. MariaDB = 10 always puts '5.5.5-'
# at the front of its version string to get around a limitation in the
# replication protocol it shares with MySQL. So if the version starts with
# '5.5.5-' then we can assume this is MariaDB and the real version number
# will immediately follow that.
$db = DB_MODULE->{'mariadb'};
# will immediately follow that. This was removed in MariaDB-11.0. The
# version should always contain "MariaDB" if it is indeed MariaDB.
if (lc($db->{name}) eq 'mysql') {
if ($output) {
Bugzilla::Install::Requirements::_checking_for({
package => $db->{name},
wanted => $db->{version},
ok => 0,
});
}
die install_string('db_maria_on_mysql', {vers => $sql_vers});
}
}
my $sql_dontwant = exists $db->{db_blocklist} ? $db->{db_blocklist} : [];
my $sql_want = $db->{db_version};
Expand All @@ -307,22 +317,14 @@ sub bz_check_server_version {
# Check what version of the database server is installed and let
# the user know if the version is too old to be used with Bugzilla.
if ($blocklisted) {
die <<EOT;
Your $sql_server v$sql_vers is blocklisted. Please check the
release notes for details or try a different database engine
or version.
EOT
die install_string('db_blocklisted', {server=>$sql_server, vers=>$sql_vers});
}
if (!$version_ok) {
die <<EOT;
Your $sql_server v$sql_vers is too old. Bugzilla requires version
$sql_want or later of $sql_server. Please download and install a
newer version.
EOT
die install_string('db_too_old', {
server => $sql_server,
vers => $sql_vers,
want => $sql_want,
});
}

# This is used by subclasses.
Expand Down
25 changes: 25 additions & 0 deletions template/en/default/setup/strings.txt.pl
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,35 @@ END
END
cpanfile_created => "##file## created",
cpan_bugzilla_home => "WARNING: Using the Bugzilla directory as the CPAN home.",
db_blocklisted => <<END,
Your ##server## v##vers## is blocklisted. Please check the
release notes for details or try a different database engine
or version.
END
db_enum_setup => "Setting up choices for standard drop-down fields:",
db_maria_on_mysql => <<END,
You appear to be using the 'mysql' database driver but the
database engine Bugzilla connected to identifies as
MariaDB ##vers##
MariaDB 10.6 and newer are no longer compatible with the mysql
database driver. Bugzilla now uses a separate driver for all
versions of MariaDB.
Please edit localconfig and set:
\$db_driver = 'mariadb';
END
db_schema_init => "Initializing bz_schema...",
db_table_new => "Adding new table ##table##...",
db_table_setup => "Creating tables...",
db_too_old => <<END,
Your ##server## v##vers## is too old. Bugzilla requires version
##want## or later of ##server##. Please download and install a
newer version.
END
done => 'done.',
enter_or_ctrl_c => "Press Enter to continue or Ctrl-C to exit...",
error_localconfig_read => <<'END',
Expand Down

0 comments on commit 7d38370

Please sign in to comment.