From 754392ed88a22aac43172d7e12f4621dae8d8484 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 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 5a0d392393..608e73b794 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/\.[^.]*/ ); -- 2.39.5