From 424912bbffffc83458fe6701d4ffb29b53cb1fdd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 31 Jul 2012 16:57:13 +0200 Subject: [PATCH] Bug 7167: We want to execute non-numeric version with the -all option Dealing with Marcel comment 100: > Note that the current code around line 52/53 does not > handle that correctly: > Argument "\x{74}\x{65}..." isn't numeric in numeric ge (>=) at > installer/data/mysql/update.pl line 52. Now, a non-numeric DBRev will be applied if you provide the --all parameter, without throwing the error Signed-off-by: Paul Poulain --- C4/Update/Database.pm | 1 + misc/bin/updatedb.pl | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) mode change 100644 => 100755 misc/bin/updatedb.pl diff --git a/C4/Update/Database.pm b/C4/Update/Database.pm index c9c180e..78c5fb3 100644 --- a/C4/Update/Database.pm +++ b/C4/Update/Database.pm @@ -515,6 +515,7 @@ sub TransformToNum { sub SetVersion { my $new_version = TransformToNum(shift); + return unless $new_version =~ /\d\.\d+/; my $current_version = TransformToNum( C4::Context->preference('Version') ); unless ( C4::Context->preference('Version') ) { my $finish = $dbh->prepare(qq{ diff --git a/misc/bin/updatedb.pl b/misc/bin/updatedb.pl old mode 100644 new mode 100755 index b79d1b4..8b613ec --- a/misc/bin/updatedb.pl +++ b/misc/bin/updatedb.pl @@ -73,8 +73,11 @@ if ($all) { : 0; for my $v (@$versions_available) { + # We execute ALL versions where version number >= min_version + # OR version is not a number if ( not grep { $v eq $_->{version} } @$versions - and C4::Update::Database::TransformToNum($v) >= $min_version ) + and ( not $v =~ /\d\.\d{2}\.\d{2}\.\d{3}/ or + C4::Update::Database::TransformToNum($v) >= $min_version ) ) { my $report = C4::Update::Database::execute_version $v; push @reports, $report; -- 1.7.9.5