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.")) ;
}
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;
}
}
-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();
$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');
=head1 NAME
SL::DBUpgrade2 - Parse database upgrade files stored in
-C<sql/Pg-upgrade2> and C<sql/Pg-upgrade2-auth> (and also in
-C<SQL/Pg-upgrade>)
+C<sql/Pg-upgrade2> and C<sql/Pg-upgrade2-auth>
=head1 SYNOPSIS
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<sql/Pg-upgrade> 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<Pg-upgrade2> files.
+which they're executed etc. The control fields are tag/value pairs
+contained in comments.
=head1 CONTROL FIELDS
depends on. All other upgrades listed in C<depends> will be applied
before the current one is applied.
-=item charset
-
-=item encoding
-
-The charset this file uses. Defaults to C<ISO-8859-15> if
-missing. Both terms are recognized.
-
=item priority
Ordering the scripts by their dependencies alone produces a lot of