From aa6a2014951597b14eb4fd089f0302b992619d11 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 30 Jun 2011 09:34:23 +0200 Subject: [PATCH] 6700: Better handling of version numbers in updatedatabase Contains a few lines of code for updatedatabase routines SetVersion and TransformToNum in order to facilitate testing new db revisions which are still marked XXX. Currently, the XXX as added in a proposed patch generates an error in the version compare. Additionally, running SetVersion while testing the upgrade is annoying and not needed. In testing stage you would like to keep your version number as is. The version number should of course be incremented when the patch is pushed. A simple test accomplishes that. Signed-off-by: Julian Maurice (cherry picked from commit c8982e1ab41ef54ba66afd3ed313e81cde307004) Signed-off-by: Chris Nighswonger (cherry picked from commit ec259212b385b718b82526121d9ff6fb144db56e) Signed-off-by: Chris Nighswonger --- installer/data/mysql/updatedatabase.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 1684044a0e..70943c07fd 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4507,6 +4507,10 @@ 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; } @@ -4517,7 +4521,9 @@ set the DBversion in the systempreferences =cut sub SetVersion { - my $kohaversion = TransformToNum(shift); + return if $_[0]=~ /XXX$/; + #you are testing a patch with a db revision; do not change version + my $kohaversion = TransformToNum($_[0]); if (C4::Context->preference('Version')) { my $finish=$dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='Version'"); $finish->execute($kohaversion); -- 2.39.5