From 3931404cd51c980ddcea4b088ce3636afa3169c8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 15 Feb 2024 10:43:06 +0100 Subject: [PATCH] Bug 34478: Regression - fix installer stuck Installer was stuck after "Set up database" with a blank page It also fixes 00-onboarding.t Signed-off-by: Jonathan Druart --- installer/install.pl | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/installer/install.pl b/installer/install.pl index 508290a16b..3c2ee27b2a 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -85,12 +85,12 @@ my $dbh = DBI->connect( $info{'user'}, $info{'password'} ); +my $op = $query->param('op') || q{}; if ( $step && $step == 1 ) { #First Step (for both fresh installations and upgrades) #Checking ALL perl Modules and services needed are installed. #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 ) @@ -141,7 +141,6 @@ if ( $step && $step == 1 ) { missing_modules => \@missing, upgrade_modules => \@upgrade, checkmodule => $checkmodule, - op => $op ); } } @@ -228,8 +227,7 @@ elsif ( $step && $step == 3 ) { # STEP 3 : database setup - my $op = $query->param('op'); - if ( $op && $op eq 'finished' ) { + if ( $op eq 'finished' ) { # Remove the HandleError set at the beginning of the installer process C4::Context->dbh->disconnect; @@ -237,7 +235,7 @@ elsif ( $step && $step == 3 ) { print $query->redirect("/cgi-bin/koha/mainpage.pl"); exit; } - elsif ( $op && $op eq 'cud-finish' ) { + elsif ( $op eq 'cud-finish' ) { $installer->set_version_syspref(); my $langchoice = $query->param('fwklanguage'); @@ -249,10 +247,9 @@ elsif ( $step && $step == 3 ) { # We just deny anybody access to install # And we redirect people to mainpage. # The installer will have to relogin since we do not pass cookie to redirection. - $template->param( "$op" => 1 ); } - elsif ( $op && $op eq 'cud-addframeworks' ) { + elsif ( $op eq 'cud-addframeworks' ) { # 1ST install, 3rd sub-step : insert the SQL files the user has selected my $langchoice = $query->param('fwklanguage'); @@ -268,9 +265,8 @@ elsif ( $step && $step == 3 ) { ); use Koha::SearchEngine::Elasticsearch; Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings; - $template->param( "$op" => 1 ); } - elsif ( $op && $op eq 'cud-selectframeworks' ) { + elsif ( $op eq 'cud-selectframeworks' ) { # # # 1ST install, 2nd sub-step : show the user the sql datas they can insert in the database. @@ -310,10 +306,9 @@ elsif ( $step && $step == 3 ) { $installer->sample_data_sql_list($langchoice); $template->param( "en_sample_data" => $sample_defaulted_to_en ); $template->param( "levelloop" => $levellist ); - $template->param( "$op" => 1 ); } - elsif ( $op && $op eq 'cud-choosemarc' ) { + elsif ( $op eq 'cud-choosemarc' ) { # # # 1ST install, 2nd sub-step : show the user the marcflavour available. @@ -365,9 +360,8 @@ elsif ( $step && $step == 3 ) { push @flavourlist, \%cell; } $template->param( "flavourloop" => \@flavourlist ); - $template->param( "$op" => 1 ); } - elsif ( $op && $op eq 'cud-importdatastructure' ) { + elsif ( $op eq 'cud-importdatastructure' ) { # # # 1st install, 1st "sub-step" : import kohastructure @@ -376,10 +370,9 @@ elsif ( $step && $step == 3 ) { my $error = $installer->load_db_schema(); $template->param( "error" => $error, - "$op" => 1, ); } - elsif ( $op && $op eq 'updatestructure' ) { + elsif ( $op eq 'updatestructure' ) { # # Not 1st install, the only sub-step : update database # @@ -458,8 +451,6 @@ elsif ( $step && $step == 3 ) { } ); } - - $template->param( $op => 1 ); } else { # @@ -535,6 +526,10 @@ else { } } } + +$op =~ s/cud-//; +$template->param( op => $op, $op => 1 ); + output_html_with_http_headers $query, $cookie, $template->output; sub chk_log { #returns a logfile in $dir or - if that failed - in temp dir -- 2.39.5