]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1851720: Don't allow "upgrading" from 5.1 to 5.2 (#165)
authorDave Miller <justdave@bugzilla.org>
Sun, 28 Apr 2024 05:15:40 +0000 (01:15 -0400)
committerGitHub <noreply@github.com>
Sun, 28 Apr 2024 05:15:40 +0000 (01:15 -0400)
checksetup.pl
template/en/default/global/code-error.html.tmpl

index 745474dce5ebbcad27f15efe3b89e8c0dc077260..0fdb2d538c28d975e52eb637c36b6314ca1e3e50 100755 (executable)
@@ -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();
 
index 830a7e7f6ef6b26b89fabaedc76b855221f56efb..e30d8da9053441383e591c3fa06bad5daf6242dc 100644 (file)
     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") %]