From: Moritz Bunkus Date: Thu, 19 Feb 2015 10:20:27 +0000 (+0100) Subject: SL::DBUpgrade2: Doppelten Code entfernen X-Git-Tag: release-3.2.0~18 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=858d25a8fac79ab2e357bbc83a5fbe9000ece7c4;p=kivitendo-erp.git SL::DBUpgrade2: Doppelten Code entfernen --- diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index 650258378..65944f213 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -297,28 +297,6 @@ sub process_file { : $self->process_perl_script($dbh, $filename, $version_or_control); } -sub update2_available { - $::lxdebug->enter_sub(); - - my ($self, $dbh) = @_; - - map { $_->{applied} = 0; } values %{ $self->{all_controls} }; - - my $sth = $dbh->prepare(qq|SELECT tag FROM | . $self->{schema} . qq|schema_info|); - if ($sth->execute) { - while (my ($tag) = $sth->fetchrow_array) { - $self->{all_controls}->{$tag}->{applied} = 1 if defined $self->{all_controls}->{$tag}; - } - } - $sth->finish(); - - my $needs_update = any { !$_->{applied} } values %{ $self->{all_controls} }; - - $::lxdebug->leave_sub(); - - return $needs_update; -} - sub unapplied_upgrade_scripts { my ($self, $dbh) = @_; @@ -335,6 +313,14 @@ sub unapplied_upgrade_scripts { return grep { !$_->{applied} } @all_scripts; } +sub update2_available { + my ($self, $dbh) = @_; + + my @unapplied_scripts = $self->unapplied_upgrade_scripts($dbh); + + return !!@unapplied_scripts; +} + sub apply_admin_dbupgrade_scripts { my ($self, $called_from_admin) = @_;