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.
---
 installer/data/mysql/updatedatabase.pl |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/installer/data/mysql/updatedatabase.pl 
b/installer/data/mysql/updatedatabase.pl
index 720bd8c..7c84736 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4441,6 +4441,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;
 }

@@ -4451,7 +4455,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);
--
1.6.0.6
_______________________________________________
Koha-patches mailing list
Koha-patches@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to