Lines 22-28
use Modern::Perl;
Link Here
|
22 |
use C4::Context; |
22 |
use C4::Context; |
23 |
|
23 |
|
24 |
use File::Basename; |
24 |
use File::Basename; |
25 |
use File::Find::Rule; |
25 |
use File::Find; |
26 |
use Digest::MD5; |
26 |
use Digest::MD5; |
27 |
use List::MoreUtils qw/uniq/; |
27 |
use List::MoreUtils qw/uniq/; |
28 |
use YAML; |
28 |
use YAML; |
Lines 60-66
sub get_versions_path {
Link Here
|
60 |
|
60 |
|
61 |
sub get_filepath { |
61 |
sub get_filepath { |
62 |
my ( $version ) = @_; |
62 |
my ( $version ) = @_; |
63 |
my @files = File::Find::Rule->file->name( "$version.sql", "$version.pl" ) ->in( ( get_versions_path() ) ); |
63 |
my @files; |
|
|
64 |
find( |
65 |
sub{ |
66 |
return unless $_ =~ m|^$version\.pl$| or $_ =~ m|^$version\.sql$|; |
67 |
push @files, $File::Find::name; |
68 |
}, |
69 |
( get_versions_path() ) |
70 |
); |
64 |
|
71 |
|
65 |
if ( scalar @files != 1 ) { |
72 |
if ( scalar @files != 1 ) { |
66 |
die "This version ($version) returned has ".scalar @files." corresponding, need only 1"; |
73 |
die "This version ($version) returned has ".scalar @files." corresponding, need only 1"; |
Lines 172-178
sub execute_version {
Link Here
|
172 |
sub list_versions_available { |
179 |
sub list_versions_available { |
173 |
my @versions; |
180 |
my @versions; |
174 |
|
181 |
|
175 |
my @files = File::Find::Rule->file->name( "*.sql", "*.pl" ) ->in( ( get_versions_path() ) ); |
182 |
my @files; |
|
|
183 |
find( |
184 |
sub{ |
185 |
return unless $_ =~ m|\.pl$| or $_ =~ m|\.sql$|; |
186 |
push @files, $File::Find::name; |
187 |
}, |
188 |
( get_versions_path() ) |
189 |
); |
176 |
|
190 |
|
177 |
for my $f ( @files ) { |
191 |
for my $f ( @files ) { |
178 |
my @file_infos = fileparse( $f, qr/\.[^.]*/ ); |
192 |
my @file_infos = fileparse( $f, qr/\.[^.]*/ ); |
179 |
- |
|
|