Bug 24545: Fix license statements
[srvgit] / t / db_dependent / check_sysprefs.t
index f7fc914..e57b15e 100755 (executable)
@@ -4,22 +4,22 @@
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-use warnings;
+use Modern::Perl;
 
+use Carp;
 use Getopt::Long;
 use C4::Context;
 
@@ -33,12 +33,13 @@ our $dbh = C4::Context->dbh;
 my $root_dir = C4::Context->config('intranetdir') . '/installer/data/mysql';
 my $base_syspref_file = "sysprefs.sql";
 
-open( my $ref_fh, "<$root_dir/$base_syspref_file" );
+open my $ref_fh, '<', "$root_dir/$base_syspref_file" or croak "Can't open '$root_dir/$base_syspref_file': $!";
 my $ref_syspref = get_syspref_from_file($ref_fh);
 my @ref_sysprefs = sort { lc $a cmp lc $b } keys %$ref_syspref;
+my $num_sysprefs = scalar @ref_sysprefs;
 if ( !$showsql ) {
-    cmp_ok( $#ref_sysprefs, '>=', 0,
-        "Found " . ( $#ref_sysprefs + 1 ) . " sysprefs" );
+    cmp_ok( $num_sysprefs, '>', 0,
+        "Found $num_sysprefs sysprefs" );
 }
 
 check_db($ref_syspref);
@@ -46,7 +47,7 @@ check_db($ref_syspref);
 #
 # Get sysprefs from SQL file populating sysprefs table with INSERT statement.
 #
-# Exemple:
+# Example:
 # INSERT INTO `systempreferences` (variable,value,explanation,options,type)
 # VALUES('AmazonLocale','US','Use to set the Locale of your Amazon.com Web Services',
 # 'US|CA|DE|FR|JP|UK','Choice')