From 20c0695a77b9c59660759e47914fdb5208d90a33 Mon Sep 17 00:00:00 2001 From: Dave Miller Date: Sun, 28 Apr 2024 01:15:40 -0400 Subject: [PATCH] Bug 1851720: Don't allow "upgrading" from 5.1 to 5.2 (#165) --- checksetup.pl | 9 +++++++++ template/en/default/global/code-error.html.tmpl | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/checksetup.pl b/checksetup.pl index 745474dce5..0fdb2d538c 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -119,6 +119,15 @@ Bugzilla::DB::bz_create_database() if $lc_hash->{'db_check'}; # now get a handle to the database: my $dbh = Bugzilla->dbh; +# We want to catch if the user is trying to "upgrade" from 5.1 because +# that's actually a downgrade and you can't do that. +my $bz51install = $dbh->bz_index_info('bz_schema', 'bz_schema_version_idx'); +if ($bz51install) { + require Bugzilla::Error; + import Bugzilla::Error; + ThrowCodeError("bz51_attempted_upgrade"); +} + # Create the tables, and do any database-specific schema changes. $dbh->bz_setup_database(); diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl index 830a7e7f6e..e30d8da905 100644 --- a/template/en/default/global/code-error.html.tmpl +++ b/template/en/default/global/code-error.html.tmpl @@ -397,6 +397,13 @@ Bugzilla does not support the search type "[% operator.truncate(30, "...") FILTER html %]". + [% ELSIF error == "bz51_attempted_upgrade" %] + [% title = "Invalid Upgrade Path" %] + It looks like you are attempting to "upgrade" from + Bugzilla 5.1. This is not supported because 5.2 is + based on Bugzilla 5.0.6 and not 5.1, so this is + actually a downgrade. + [% ELSE %] [%# Try to find hooked error messages %] [% error_message = Hook.process("errors") %] -- 2.47.3