From: Dave Miller Date: Sun, 28 Apr 2024 04:44:26 +0000 (-0400) Subject: Bug 1851354: blocklist MySQL 8+, offer MariaDB (#143) X-Git-Tag: bugzilla-5.3.3~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4854aec9dd8ecef82679a4f2fbf6688516a15f56;p=thirdparty%2Fbugzilla.git Bug 1851354: blocklist MySQL 8+, offer MariaDB (#143) --- diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index a6dedc969b..4d9679c78c 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -540,7 +540,16 @@ 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', name => 'MySQL'}, + # We blocklist MySQL 8.0 and newer, and explicitly list MariaDB as an + # alternative. The db_blklst_str is shown in the auto-generated release notes + # instead of the regexp. We can't tell Maria apart from MySQL in our check + # and MariaDB skipped versions from 5 to 10, so we'll blocklist 8 and 9 for + # MariaDB as well just in case someone configured for 'mariadb' but actually + # has MySQL installed. See https://bugzilla.mozilla.org/show_bug.cgi?id=1851354 + mysql => {db => 'Bugzilla::DB::Mysql', db_version => '5.0.15', name => 'MySQL', + db_blocklist => ['^[89]\.'], db_blklst_str => '>= 8.0'}, + mariadb => {db => 'Bugzilla::DB::Mysql', db_version => '5.1', name => 'MariaDB', + db_blocklist => ['^[89]\.']}, pg => {db => 'Bugzilla::DB::Pg', db_version => '9.00.0000', name => 'PostgreSQL'}, oracle => diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index be692cc8fc..cb9557a0a3 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -187,7 +187,13 @@ sub bz_check_server_version { $self->disconnect; my $sql_want = $db->{db_version}; + my $sql_dontwant = exists $db->{db_blocklist} ? $db->{db_blocklist} : []; my $version_ok = vers_cmp($sql_vers, $sql_want) > -1 ? 1 : 0; + my $blocklisted; + if ($version_ok) { + $blocklisted = grep($sql_vers =~ /$_/, @$sql_dontwant); + $version_ok = 0 if $blocklisted; + } my $sql_server = $db->{name}; if ($output) { @@ -195,12 +201,22 @@ sub bz_check_server_version { package => $sql_server, wanted => $sql_want, found => $sql_vers, - ok => $version_ok + ok => $version_ok, + blocklisted => $blocklisted }); } # 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 < '(blacklisted)', + blocklisted => '(blocklisted)', bz_schema_exists_before_220 => <<'END', You are upgrading from a version before 2.20, but the bz_schema table already exists. This means that you restored a mysqldump into the Bugzilla