X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=installer%2Finstall.pl;h=0b2a683a2d039364c81394d88a3200b2983919f1;hb=a34d086a24b1e4519f8b31331d4c42b87b8e4a83;hp=83bf21303c724526763731bc91419c92e1d5aad9;hpb=0492fcf87f170846d1e6c8683916a56cb67ce9a7;p=koha-ffzg.git diff --git a/installer/install.pl b/installer/install.pl index 83bf21303c..0b2a683a2d 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -17,8 +17,7 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; use diagnostics; use C4::InstallAuth; @@ -30,6 +29,7 @@ use C4::Output; use C4::Templates; use C4::Languages qw(getAllLanguages getTranslatedLanguages); use C4::Installer; +use C4::Installer::PerlModules; use Koha; @@ -89,11 +89,13 @@ if ( $step && $step == 1 ) { #Whenever there is an error, adding a report to the page my $op = $query->param('op') || 'noop'; $template->param( language => 1 ); + my $checkmodule = 1; $template->param( 'checkmodule' => 1 ) ; # we start with the assumption that there are no problems and set this to 0 if there are unless ( $] >= 5.010000 ) { # Bug 7375 $template->param( problems => 1, perlversion => 1, checkmodule => 0 ); + $checkmodule = 0; } my $perl_modules = C4::Installer::PerlModules->new; @@ -102,7 +104,6 @@ if ( $step && $step == 1 ) { my $modules = $perl_modules->get_attr('missing_pm'); if ( scalar(@$modules) ) { my @components = (); - my $checkmodule = 1; foreach (@$modules) { my ( $module, $stats ) = each %$_; $checkmodule = 0 if $stats->{'required'}; @@ -144,10 +145,11 @@ elsif ( $step && $step == 2 ) { $template->param( 'checkdatabasecreated' => 1 ); } - #Check if user have all necessary grants on this database. - my $rq = - $dbh->prepare( - "SHOW GRANTS FOR \'$info{user}\'\@'$info{hostname}'"); + # Check if user have all necessary grants on this database. + # CURRENT_USER is ANSI SQL, and doesn't require mysql table + # privileges, making the % check pointless, since they + # couldn't even check GRANTS if they couldn't connect. + my $rq = $dbh->prepare('SHOW GRANTS FOR CURRENT_USER'); $rq->execute; my $grantaccess; while ( my ($line) = $rq->fetchrow ) { @@ -167,27 +169,6 @@ elsif ( $step && $step == 2 ) { ); } } - unless ($grantaccess) { - $rq = - $dbh->prepare("SHOW GRANTS FOR \'$info{user}\'\@'\%'"); - $rq->execute; - while ( my ($line) = $rq->fetchrow ) { - my $dbname = $info{dbname}; - if ( $line =~ m/$dbname/ || index( $line, '*.*' ) > 0 ) - { - $grantaccess = 1 - if ( - index( $line, 'ALL PRIVILEGES' ) > 0 - || ( ( index( $line, 'SELECT' ) > 0 ) - && ( index( $line, 'INSERT' ) > 0 ) - && ( index( $line, 'UPDATE' ) > 0 ) - && ( index( $line, 'DELETE' ) > 0 ) - && ( index( $line, 'CREATE' ) > 0 ) - && ( index( $line, 'DROP' ) > 0 ) ) - ); - } - } - } $template->param( "checkgrantaccess" => $grantaccess ); } # End mysql connect check... @@ -245,7 +226,7 @@ elsif ( $step && $step == 3 ) { my ( $fwk_language, $list ) = $installer->load_sql_in_order( $all_languages, - $query->param('framework') ); + $query->multi_param('framework') ); $template->param( "fwklanguage" => $fwk_language, "list" => $list @@ -296,9 +277,6 @@ elsif ( $step && $step == 3 ) { $template->param( "levelloop" => $levellist ); $template->param( "$op" => 1 ); - my $setup = $query->param('setup'); - $template->param( "setup" => $setup ); - } elsif ( $op && $op eq 'choosemarc' ) { # @@ -314,7 +292,7 @@ elsif ( $step && $step == 3 ) { # Where is a category of requirement : required, recommended optional # level should contain : # SQL File for import With a readable name. -# txt File taht explains what this SQL File is meant for. +# txt File that explains what this SQL File is meant for. # Could be VERY useful to have A Big file for a kind of library. # But could also be useful to have some Authorised values data set prepared here. # Marcflavour Selection is achieved through radiobuttons. @@ -343,16 +321,12 @@ elsif ( $step && $step == 3 ) { my $marcflavour = C4::Context->preference("marcflavour"); my @flavourlist; foreach my $marc (@listdir) { - my %cell = ( - "label" => ucfirst($marc), - "code" => uc($marc), - "checked" => defined($marcflavour) - ? uc($marc) eq $marcflavour - : 0 - ); - + my %cell=( + "label"=> ucfirst($marc), + "code"=>uc($marc), + "checked"=> defined($marcflavour) ? uc($marc) eq $marcflavour : 0); # $cell{"description"}= do { local $/ = undef; open INPUT "<$dir/$marc.txt"||""; }; - push @flavourlist, \%cell; + push @flavourlist, \%cell; } $template->param( "flavourloop" => \@flavourlist ); $template->param( "$op" => 1 ); @@ -401,7 +375,7 @@ elsif ( $step && $step == 3 ) { system($cmd ); my $fh; - open( $fh, "<", $logfilepath ) + open( $fh, "<:encoding(utf-8)", $logfilepath ) or die "Cannot open log file $logfilepath: $!"; my @report = <$fh>; close $fh; @@ -414,7 +388,7 @@ elsif ( $step && $step == 3 ) { else { eval { `rm $logfilepath` }; } - open( $fh, "<", $logfilepath_errors ) + open( $fh, "<:encoding(utf-8)", $logfilepath_errors ) or die "Cannot open log file $logfilepath_errors: $!"; @report = <$fh>; close $fh;