From: Dave Miller Date: Mon, 4 Sep 2023 05:06:35 +0000 (-0400) Subject: Bug 1851354: blocklist MySQL 8+, offer MariaDB X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=77857c4dd2d9c659fda3239c4839146fece4e01b;p=thirdparty%2Fbugzilla.git Bug 1851354: blocklist MySQL 8+, offer MariaDB --- diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 60ca7cc341..a74d910b3a 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -471,7 +471,11 @@ use constant INSTALLATION_MODE_NON_INTERACTIVE => 1; use constant DB_MODULE => { # MySQL 5.0.15 was the first production 5.0.x release. 'mysql' => {db => 'Bugzilla::DB::Mysql', db_version => '5.0.15', - dbd => { + db_blacklist => ['^[89]\.'], + # the following is a "human-readable" version to show in the + # release notes + db_blklst_str => '>= 8.0', + dbd => { package => 'DBD-mysql', module => 'DBD::mysql', # Disallow development versions @@ -481,6 +485,28 @@ use constant DB_MODULE => { version => '4.001', }, name => 'MySQL'}, + + # MariaDB is a drop-in replacement for MySQL and works with Bugzilla + 'mariadb' => {db => 'Bugzilla::DB::Mysql', db_version => '5.1', + # MariaDB is indistinguishable from MySQL, but skipped 8 and + # 9 so blacklist it anyway in case someone has the driver set + # to mariadb but actually has MySQL. + db_blacklist => ['^[89]\.'], + # no string to show the user on the release notes though. + dbd => { + package => 'DBD-mysql', + module => 'DBD::mysql', + + # Disallow development versions + blacklist => ['_'], + + # For UTF-8 support. 4.001 makes sure that blobs aren't + # marked as UTF-8. + version => '4.001', + }, + name => 'MariaDB' + }, + # Also see Bugzilla::DB::Pg::bz_check_server_version, which has special # code to require DBD::Pg 2.17.2 for PostgreSQL 9 and above. 'pg' => {db => 'Bugzilla::DB::Pg', db_version => '8.03.0000', diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index 248312e121..93cb74242d 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -200,17 +200,33 @@ sub bz_check_server_version { $self->disconnect; my $sql_want = $db->{db_version}; + my $sql_dontwant = exists $db->{db_blacklist} ? $db->{db_blacklist} : []; my $version_ok = vers_cmp($sql_vers, $sql_want) > -1 ? 1 : 0; + my $blacklisted; + if ($version_ok) { + $blacklisted = grep($sql_vers =~ /$_/, @$sql_dontwant); + $version_ok = 0 if $blacklisted; + } my $sql_server = $db->{name}; if ($output) { Bugzilla::Install::Requirements::_checking_for({ package => $sql_server, wanted => $sql_want, - found => $sql_vers, ok => $version_ok }); + found => $sql_vers, ok => $version_ok, + blacklisted => $blacklisted }); } # 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 ($blacklisted) { + die <