$main::lxdebug->leave_sub();
}
+sub process_file {
+ my ($self, $dbh, $filename, $version_or_control, $db_charset) = @_;
+
+ if ($filename =~ m/sql$/) {
+ $self->process_query($dbh, $filename, $version_or_control, $db_charset);
+ } else {
+ $self->process_perl_script($dbh, $filename, $version_or_control, $db_charset);
+ }
+}
+
sub _check_for_loops {
my ($form, $file_name, $controls, $tag, @path) = @_;
foreach my $upgradescript (@upgradescripts) {
my $a = $upgradescript;
$a =~ s/^\Q$form->{dbdriver}\E-upgrade-|\.(sql|pl)$//g;
- my $file_type = $1;
my ($mindb, $maxdb) = split /-/, $a;
my $str_maxdb = $maxdb;
# apply upgrade
$main::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $upgradescript");
- if ($file_type eq "sql") {
- $dbupdater->process_query($dbh, "sql/" . $form->{"dbdriver"} . "-upgrade/$upgradescript", $str_maxdb, $db_charset);
- } else {
- $dbupdater->process_perl_script($dbh, "sql/" . $form->{"dbdriver"} . "-upgrade/$upgradescript", $str_maxdb, $db_charset);
- }
+ $dbupdater->process_file($dbh, "sql/" . $form->{"dbdriver"} . "-upgrade/$upgradescript", $str_maxdb, $db_charset);
$version = $maxdb;
$main::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $control->{file}");
print $form->parse_html_template("dbupgrade/upgrade_message2", $control);
- if ($file_type eq "sql") {
- $dbupdater->process_query($dbh, "sql/" . $form->{"dbdriver"} . "-upgrade2/$control->{file}", $control, $db_charset);
- } else {
- $dbupdater->process_perl_script($dbh, "sql/" . $form->{"dbdriver"} . "-upgrade2/$control->{file}", $control, $db_charset);
- }
+ $dbupdater->process_file($dbh, "sql/" . $form->{"dbdriver"} . "-upgrade2/$control->{file}", $control, $db_charset);
}
$rc = 0;