Bug 13893: Add ability to execute perl scripts in atomicupdates

Bug 13068 adds the ability to execute sql files from atomicupdates for
in process developments to reduce merge conflicts. We need to extend
this ability further to be able to handle perl code.

Revised Test Plan
-----------------
1) Run updatedatabase.pl
   -- Expect output to be similar to:
   $ ./installer/data/mysql/updatedatabase.pl
   DEV atomic update : test.perl
   Upgrade to XXX done (Bug 13893 - Add ability to execute perl scripts in atomicupdates)
2) Run koha qa test tools.
   -- only need to check last commit (-c 1), because first commit is a
      sample file which shouldn't be pushed.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Kyle Hall 2015-03-23 09:19:03 -04:00 committed by Tomas Cohen Arazi
parent a94d5297ab
commit 74e5f64fd7

View file

@ -10308,10 +10308,13 @@ if ( CheckVersion($DBversion) ) {
my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';
opendir( my $dirh, $update_dir );
while ( my $file = readdir $dirh ) {
next unless $file =~ /\.sql$/; # skip non SQL files
print "DEV atomic update : $file \n";
my $installer = C4::Installer->new();
my $rv = $installer->load_sql( $update_dir . $file ) ? 0 : 1;
if ( $file =~ /\.sql$/ ) { # skip non SQL files
print "DEV atomic update : $file \n";
my $installer = C4::Installer->new();
my $rv = $installer->load_sql( $update_dir . $file ) ? 0 : 1;
} elsif ( $file =~ /\.perl$/ ) {
do $update_dir . $file;
}
}
=head1 FUNCTIONS