From: Dave Miller Date: Sun, 28 Apr 2024 05:15:40 +0000 (-0400) Subject: Bug 1851720: Don't allow "upgrading" from 5.1 to 5.2 (#165) X-Git-Tag: bugzilla-5.2~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=20c0695a77b9c59660759e47914fdb5208d90a33;p=thirdparty%2Fbugzilla.git Bug 1851720: Don't allow "upgrading" from 5.1 to 5.2 (#165) --- diff --git a/checksetup.pl b/checksetup.pl index 745474dce..0fdb2d538 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 830a7e7f6..e30d8da90 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") %]