Bug 13893: [QA Follow-up] Move print statement, sort files in loop
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 16 Apr 2015 13:34:25 +0000 (15:34 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 29 Apr 2015 18:38:41 +0000 (15:38 -0300)
Just moving the print statement for DEV updates to show them too for
the new perl format.
In the loop opendir..readdir is used; this might not be always in the
expected order. I added a sort to force the order.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
installer/data/mysql/updatedatabase.pl

index b2c0821..48c8122 100755 (executable)
@@ -10307,9 +10307,10 @@ if ( CheckVersion($DBversion) ) {
 
 my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';
 opendir( my $dirh, $update_dir );
-while ( my $file = readdir $dirh ) {
-    if ( $file =~ /\.sql$/ ) {    # skip non SQL files
-        print "DEV atomic update : $file \n";
+foreach my $file ( sort readdir $dirh ) {
+    next if $file !~ /\.(sql|perl)$/;  #skip other files
+    print "DEV atomic update: $file\n";
+    if ( $file =~ /\.sql$/ ) {
         my $installer = C4::Installer->new();
         my $rv = $installer->load_sql( $update_dir . $file ) ? 0 : 1;
     } elsif ( $file =~ /\.perl$/ ) {