From 2b31bcbfb48ad1ef8da19703e1a2d1fa832026c6 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 28 Aug 2017 10:13:29 +0200 Subject: [PATCH] DB-Upgrade: Dauer jedes Upgrade-Scripts timen --- SL/DBUpgrade2.pm | 12 ++++++++++-- SL/User.pm | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index bd65a1ac7..82bd27f25 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -291,8 +291,12 @@ sub process_perl_script { sub process_file { my ($self, $dbh, $filename, $version_or_control) = @_; - return $filename =~ m/sql$/ ? $self->process_query( $dbh, $filename, $version_or_control) - : $self->process_perl_script($dbh, $filename, $version_or_control); + my $result = $filename =~ m/sql$/ ? $self->process_query( $dbh, $filename, $version_or_control) + : $self->process_perl_script($dbh, $filename, $version_or_control); + + $::lxdebug->log_time("DB upgrade script '${filename}' finished"); + + return $result; } sub unapplied_upgrade_scripts { @@ -338,6 +342,8 @@ sub apply_admin_dbupgrade_scripts { print $self->{form}->parse_html_template("dbupgrade/header", { dbname => $::auth->{DB_config}->{db} }); + $::lxdebug->log_time("DB upgrades commencing"); + foreach my $control (@unapplied_scripts) { $::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $control->{file}"); print $self->{form}->parse_html_template("dbupgrade/upgrade_message2", $control); @@ -345,6 +351,8 @@ sub apply_admin_dbupgrade_scripts { $self->process_file($dbh, "sql/Pg-upgrade2-auth/$control->{file}", $control); } + $::lxdebug->log_time("DB upgrades finished"); + print $self->{form}->parse_html_template("dbupgrade/footer", { is_admin => 1 }) if $called_from_admin; return 1; diff --git a/SL/User.pm b/SL/User.pm index 593707c82..f324e3629 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -443,6 +443,8 @@ sub dbupdate2 { my @upgradescripts = $dbupdater->unapplied_upgrade_scripts($dbh); + $::lxdebug->log_time("DB upgrades commencing"); + foreach my $control (@upgradescripts) { # Apply upgrade. Control will only return to us if the upgrade has # been applied correctly and if the update has not requested user @@ -453,6 +455,8 @@ sub dbupdate2 { $dbupdater->process_file($dbh, "sql/Pg-upgrade2/$control->{file}", $control); } + $::lxdebug->log_time("DB upgrades finished"); + $dbh->disconnect; } -- 2.20.1