Bugzilla – Attachment 152543 Details for
Bug 34088
Schema upgrade should short circuit faster if no upgrade needs to be done
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34088: Short circuit database upgrade check
Bug-34088-Short-circuit-database-upgrade-check.patch (text/plain), 2.02 KB, created by
David Cook
on 2023-06-22 00:57:02 UTC
(
hide
)
Description:
Bug 34088: Short circuit database upgrade check
Filename:
MIME Type:
Creator:
David Cook
Created:
2023-06-22 00:57:02 UTC
Size:
2.02 KB
patch
obsolete
>From 9bbd54ae4ee5e91388181c8a2699c6ca85168441 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 22 Jun 2023 00:56:12 +0000 >Subject: [PATCH] Bug 34088: Short circuit database upgrade check > >If the database version and the code version are the same, we should >short circuit and exit immediately. >--- > Koha/Installer.pm | 40 ++++++++++++++++++++++++++ > installer/data/mysql/updatedatabase.pl | 2 ++ > 2 files changed, 42 insertions(+) > create mode 100644 Koha/Installer.pm > >diff --git a/Koha/Installer.pm b/Koha/Installer.pm >new file mode 100644 >index 0000000000..2df4620037 >--- /dev/null >+++ b/Koha/Installer.pm >@@ -0,0 +1,40 @@ >+package Koha::Installer; >+ >+use Modern::Perl; >+ >+require Koha; >+require Koha::Database; >+ >+sub import { >+ my $dbh = Koha::Database::dbh(); >+ my $sql = "SELECT value FROM systempreferences WHERE variable = 'Version'"; >+ my $sth = $dbh->prepare($sql); >+ $sth->execute(); >+ my $row = $sth->fetchrow_arrayref(); >+ my $db_version = $row->[0]; >+ my $koha_version = Koha->version; >+ my $code_version = TransformToNum($koha_version); >+ if ($db_version == $code_version){ >+ exit; >+ } >+} >+ >+=head2 TransformToNum >+ >+Transform the Koha version from a 4 parts string >+to a number, with just 1 . >+ >+=cut >+ >+sub TransformToNum { >+ my $version = shift; >+ # remove the 3 last . to have a Perl number >+ $version =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/; >+ # three X's at the end indicate that you are testing patch with dbrev >+ # change it into 999 >+ # prevents error on a < comparison between strings (should be: lt) >+ $version =~ s/XXX$/999/; >+ return $version; >+} >+ >+1; >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index c95fdf3e3c..9597fad73e 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -27,6 +27,8 @@ > > # NOTE: Please keep the version in kohaversion.pl up-to-date! > >+use Koha::Installer; >+ > use Modern::Perl; > > use feature 'say'; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34088
:
152543
|
152995
|
152996
|
152997
|
152998
|
154230
|
170554
|
170555
|
171050
|
174441
|
174443