From e541190abfa49bba5d81d36e1ee6b2c12bc6a973 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 3 Dec 2012 16:39:10 +0100 Subject: [PATCH] Bug 7167: Followup: Removes useless global variables Content-Type: text/plain; charset="utf-8" Signed-off-by: Chris Nighswonger --- C4/Update/Database.pm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/C4/Update/Database.pm b/C4/Update/Database.pm index 5a0d392..608e73b 100644 --- a/C4/Update/Database.pm +++ b/C4/Update/Database.pm @@ -41,12 +41,18 @@ C4::Update::Database.pm =cut -my $VERSIONS_PATH = C4::Context->config('intranetdir') . '/installer/data/mysql/versions'; +our $dbh = C4::Context->dbh; -my $version; -my $list; +=head2 get_versions_path -my $dbh = C4::Context->dbh; + return the path to the version files + +=cut + +sub get_versions_path { + return C4::Context->config('intranetdir') . '/installer/data/mysql/versions'; + +} =head2 get_filepath @@ -57,7 +63,7 @@ my $dbh = C4::Context->dbh; sub get_filepath { my ( $version ) = @_; - my @files = File::Find::Rule->file->name( "$version.sql", "$version.pl" ) ->in( ( $VERSIONS_PATH ) ); + my @files = File::Find::Rule->file->name( "$version.sql", "$version.pl" ) ->in( ( get_versions_path() ) ); if ( scalar @files != 1 ) { die "This version ($version) returned has ".scalar @files." corresponding, need only 1"; @@ -169,7 +175,7 @@ sub execute_version { sub list_versions_available { my @versions; - my @files = File::Find::Rule->file->name( "*.sql", "*.pl" ) ->in( ( $VERSIONS_PATH ) ); + my @files = File::Find::Rule->file->name( "*.sql", "*.pl" ) ->in( ( get_versions_path() ) ); for my $f ( @files ) { my @file_infos = fileparse( $f, qr/\.[^.]*/ ); -- 1.7.9.5