]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1896055: Don't talk to MariaDB with the MySQL driver (#129)
authorDave Miller <justdave@bugzilla.org>
Tue, 14 May 2024 06:18:35 +0000 (02:18 -0400)
committerGitHub <noreply@github.com>
Tue, 14 May 2024 06:18:35 +0000 (02:18 -0400)
Bugzilla/DB.pm
template/en/default/setup/strings.txt.pl

index c71e5f10e05f34b63e37461fd6e6a43d8c424143..268f5cd477bfff757191008f4b9bc23d63b2e5ed 100644 (file)
@@ -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};
@@ -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.
index 449015b1e649fa6f874c2cb83a92c11d53d06a52..221f5066610479283e5daf13ba614d5528f99bec 100644 (file)
@@ -56,10 +56,35 @@ to continue.
 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',