X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDBUpgrade2.pm;h=2b979425750ef9f61870e4fc8668b21ee5a1e693;hb=0e43d3cfea2cfdb938490c8221048b235f754fd3;hp=54a651c057025a5505f2f358170fbf325c9543e2;hpb=dbda14c263efd93aca3b7114015a47d86b8581e3;p=kivitendo-erp.git diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index 54a651c05..2b9794257 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -81,9 +81,6 @@ sub parse_dbupdate_controls { next if ($control->{ignore}); - $control->{charset} = 'UTF-8' if $file =~ m/\.pl$/; - $control->{charset} = $control->{charset} || $control->{encoding} || 'UTF-8'; - if (!$control->{"tag"}) { _control_error($form, $file_name, $locale->text("Missing 'tag' field.")) ; } @@ -141,19 +138,10 @@ sub process_query { my $sth; my @quote_chars; - my $file_charset = 'UTF-8'; - while (<$fh>) { - last if !/^--/; - next if !/^--\s*\@(?:charset|encoding):\s*(.+)/; - $file_charset = $1; - last; - } - $fh->seek(0, SEEK_SET); - $dbh->begin_work(); while (<$fh>) { - $_ = SL::Iconv::convert($file_charset, 'UTF-8', $_); + $_ = SL::Iconv::convert('UTF-8', 'UTF-8', $_); # Remove DOS and Unix style line endings. chomp; @@ -295,18 +283,6 @@ sub process_file { } } -sub update_available { - my ($self, $cur_version) = @_; - - local *SQLDIR; - - opendir SQLDIR, "sql/Pg-upgrade" || error("", "sql/Pg-upgrade: $!"); - my @upgradescripts = grep /Pg-upgrade-\Q$cur_version\E.*\.(sql|pl)$/, readdir SQLDIR; - closedir SQLDIR; - - return ($#upgradescripts > -1); -} - sub update2_available { $::lxdebug->enter_sub(); @@ -357,7 +333,7 @@ sub apply_admin_dbupgrade_scripts { $self->{form}->{login} ||= 'admin'; - map { $_->{description} = SL::Iconv::convert($_->{charset}, 'UTF-8', $_->{description}) } values %{ $self->{all_controls} }; + map { $_->{description} = SL::Iconv::convert('UTF-8', 'UTF-8', $_->{description}) } values %{ $self->{all_controls} }; if ($called_from_admin) { $self->{form}->{title} = $::locale->text('Dataset upgrade'); @@ -446,8 +422,7 @@ __END__ =head1 NAME SL::DBUpgrade2 - Parse database upgrade files stored in -C and C (and also in -C) +C and C =head1 SYNOPSIS @@ -495,14 +470,8 @@ applied. Database upgrade files come in two flavours: SQL files and Perl files. For both there are control fields that determine the order in -which they're executed, what charset the scripts are written in -etc. The control fields are tag/value pairs contained in comments. - -=head1 OLD UPGRADE FILES - -The files in C are so old that I don't bother -documenting them. They're handled by this class, too, but new files -are only created as C files. +which they're executed etc. The control fields are tag/value pairs +contained in comments. =head1 CONTROL FIELDS @@ -547,13 +516,6 @@ A space-separated list of tags of scripts this particular script depends on. All other upgrades listed in C will be applied before the current one is applied. -=item charset - -=item encoding - -The charset this file uses. Defaults to C if -missing. Both terms are recognized. - =item priority Ordering the scripts by their dependencies alone produces a lot of