View | Details | Raw Unified | Return to bug 22824
Collapse All | Expand All

(-)a/C4/Installer.pm (-4 / +4 lines)
Lines 21-27 use Modern::Perl; Link Here
21
21
22
use Encode qw( encode is_utf8 );
22
use Encode qw( encode is_utf8 );
23
use DBIx::RunSQL;
23
use DBIx::RunSQL;
24
use YAML::Syck qw( LoadFile );
24
use YAML::XS;
25
use C4::Context;
25
use C4::Context;
26
use DBI;
26
use DBI;
27
use Koha;
27
use Koha;
Lines 153-159 sub marc_framework_sql_list { Link Here
153
            my ( $name, $ext ) = split /\./, $_;
153
            my ( $name, $ext ) = split /\./, $_;
154
            my @lines;
154
            my @lines;
155
            if ( $ext =~ /yml/ ) {
155
            if ( $ext =~ /yml/ ) {
156
                my $yaml = LoadFile("$dir/$requirelevel/$name\.$ext");
156
                my $yaml = YAML::XS::LoadFile("$dir/$requirelevel/$name\.$ext");
157
                @lines = map { Encode::decode('UTF-8', $_) } @{ $yaml->{'description'} };
157
                @lines = map { Encode::decode('UTF-8', $_) } @{ $yaml->{'description'} };
158
            } else {
158
            } else {
159
                open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
159
                open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
Lines 236-242 sub sample_data_sql_list { Link Here
236
            my ( $name, $ext ) = split /\./, $_;
236
            my ( $name, $ext ) = split /\./, $_;
237
            my @lines;
237
            my @lines;
238
            if ( $ext =~ /yml/ ) {
238
            if ( $ext =~ /yml/ ) {
239
                my $yaml = LoadFile("$dir/$requirelevel/$name\.$ext");
239
                my $yaml = YAML::XS::LoadFile("$dir/$requirelevel/$name\.$ext");
240
                @lines = map { Encode::decode('UTF-8', $_) } @{ $yaml->{'description'} };
240
                @lines = map { Encode::decode('UTF-8', $_) } @{ $yaml->{'description'} };
241
            } else {
241
            } else {
242
                open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
242
                open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
Lines 560-566 sub load_sql { Link Here
560
        }
560
        }
561
        else {                                                                       # YAML files
561
        else {                                                                       # YAML files
562
            eval {
562
            eval {
563
                my $yaml         = LoadFile( $filename );                            # Load YAML
563
                my $yaml         = YAML::XS::LoadFile( $filename );                            # Load YAML
564
                for my $table ( @{ $yaml->{'tables'} } ) {
564
                for my $table ( @{ $yaml->{'tables'} } ) {
565
                    my $query_info   = process_yml_table($table);
565
                    my $query_info   = process_yml_table($table);
566
                    my $query        = $query_info->{query};
566
                    my $query        = $query_info->{query};
(-)a/C4/Message.pm (-2 / +3 lines)
Lines 23-29 use strict; Link Here
23
use warnings;
23
use warnings;
24
use C4::Context;
24
use C4::Context;
25
use C4::Letters;
25
use C4::Letters;
26
use YAML::Syck;
26
use YAML::XS;
27
use Encode;
27
use Carp;
28
use Carp;
28
29
29
=head1 NAME
30
=head1 NAME
Lines 282-288 sub metadata { Link Here
282
        $self->content($self->render_metadata);
283
        $self->content($self->render_metadata);
283
        return $data;
284
        return $data;
284
    } else {
285
    } else {
285
        return Load($self->{metadata});
286
        return YAML::XS::Load(Encode::encode_utf8($self->{metadata}));
286
    }
287
    }
287
}
288
}
288
289
(-)a/Koha/OAI/Server/Repository.pm (-2 / +2 lines)
Lines 32-38 use Koha::OAI::Server::GetRecord; Link Here
32
use Koha::OAI::Server::ListRecords;
32
use Koha::OAI::Server::ListRecords;
33
use Koha::OAI::Server::ListIdentifiers;
33
use Koha::OAI::Server::ListIdentifiers;
34
use XML::SAX::Writer;
34
use XML::SAX::Writer;
35
use YAML::Syck qw( LoadFile );
35
use YAML::XS;
36
use CGI qw/:standard -oldstyle_urls/;
36
use CGI qw/:standard -oldstyle_urls/;
37
use C4::Context;
37
use C4::Context;
38
use C4::Biblio;
38
use C4::Biblio;
Lines 108-114 sub new { Link Here
108
108
109
    # Load configuration file if defined in OAI-PMH:ConfFile syspref
109
    # Load configuration file if defined in OAI-PMH:ConfFile syspref
110
    if ( my $file = C4::Context->preference("OAI-PMH:ConfFile") ) {
110
    if ( my $file = C4::Context->preference("OAI-PMH:ConfFile") ) {
111
        $self->{ conf } = LoadFile( $file );
111
        $self->{ conf } = YAML::XS::LoadFile( $file );
112
        my @formats = keys %{ $self->{conf}->{format} };
112
        my @formats = keys %{ $self->{conf}->{format} };
113
        $self->{ koha_metadata_format } =  \@formats;
113
        $self->{ koha_metadata_format } =  \@formats;
114
    }
114
    }
(-)a/Koha/SearchEngine/Elasticsearch.pm (-4 / +4 lines)
Lines 37-43 use Modern::Perl; Link Here
37
use Readonly;
37
use Readonly;
38
use Search::Elasticsearch;
38
use Search::Elasticsearch;
39
use Try::Tiny;
39
use Try::Tiny;
40
use YAML::Syck;
40
use YAML::XS;
41
41
42
use List::Util qw( sum0 reduce all );
42
use List::Util qw( sum0 reduce all );
43
use MARC::File::XML;
43
use MARC::File::XML;
Lines 164-170 sub get_elasticsearch_settings { Link Here
164
    if (!defined $settings) {
164
    if (!defined $settings) {
165
        my $config_file = C4::Context->config('elasticsearch_index_config');
165
        my $config_file = C4::Context->config('elasticsearch_index_config');
166
        $config_file ||= C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/index_config.yaml';
166
        $config_file ||= C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/index_config.yaml';
167
        $settings = LoadFile( $config_file );
167
        $settings = YAML::XS::LoadFile( $config_file );
168
    }
168
    }
169
169
170
    return $settings;
170
    return $settings;
Lines 312-318 sub _get_elasticsearch_field_config { Link Here
312
    if (!defined $settings) {
312
    if (!defined $settings) {
313
        my $config_file = C4::Context->config('elasticsearch_field_config');
313
        my $config_file = C4::Context->config('elasticsearch_field_config');
314
        $config_file ||= C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/field_config.yaml';
314
        $config_file ||= C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/field_config.yaml';
315
        $settings = LoadFile( $config_file );
315
        $settings = YAML::XS::LoadFile( $config_file );
316
    }
316
    }
317
317
318
    if (!defined $settings->{$purpose}) {
318
    if (!defined $settings->{$purpose}) {
Lines 341-347 $indexes = _load_elasticsearch_mappings(); Link Here
341
sub _load_elasticsearch_mappings {
341
sub _load_elasticsearch_mappings {
342
    my $mappings_yaml = C4::Context->config('elasticsearch_index_mappings');
342
    my $mappings_yaml = C4::Context->config('elasticsearch_index_mappings');
343
    $mappings_yaml ||= C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/mappings.yaml';
343
    $mappings_yaml ||= C4::Context->config('intranetdir') . '/admin/searchengine/elasticsearch/mappings.yaml';
344
    return LoadFile( $mappings_yaml );
344
    return YAML::XS::LoadFile( $mappings_yaml );
345
}
345
}
346
346
347
sub reset_elasticsearch_mappings {
347
sub reset_elasticsearch_mappings {
(-)a/admin/preferences.pl (-4 / +4 lines)
Lines 31-40 use C4::Templates; Link Here
31
use Koha::Acquisition::Currencies;
31
use Koha::Acquisition::Currencies;
32
use File::Spec;
32
use File::Spec;
33
use IO::File;
33
use IO::File;
34
use YAML::Syck qw();
34
use YAML::XS;
35
use Encode;
35
use List::MoreUtils qw(any);
36
use List::MoreUtils qw(any);
36
$YAML::Syck::ImplicitTyping = 1;
37
$YAML::Syck::ImplicitUnicode = 1;
38
37
39
# use Smart::Comments;
38
# use Smart::Comments;
40
#
39
#
Lines 53-59 sub GetTab { Link Here
53
        local_currency => $local_currency, # currency code is used, because we do not know how a given currency is formatted.
52
        local_currency => $local_currency, # currency code is used, because we do not know how a given currency is formatted.
54
    );
53
    );
55
54
56
    return YAML::Syck::Load( $tab_template->output() );
55
    return YAML::XS::Load( Encode::encode_utf8($tab_template->output()));
57
}
56
}
58
57
59
sub _get_chunk {
58
sub _get_chunk {
Lines 237-242 sub SearchPrefs { Link Here
237
    our @terms = split( /\s+/, $searchfield );
236
    our @terms = split( /\s+/, $searchfield );
238
237
239
    foreach my $tab_name ( sort keys %tab_files ) {
238
    foreach my $tab_name ( sort keys %tab_files ) {
239
        # FIXME Hum?
240
        # Force list context to remove 'uninitialized value in goto' warn coming from YAML::Syck; note that the other GetTab call is in list context too. The actual cause however is the null value for the pref OpacRenewalBranch in opac.pref
240
        # Force list context to remove 'uninitialized value in goto' warn coming from YAML::Syck; note that the other GetTab call is in list context too. The actual cause however is the null value for the pref OpacRenewalBranch in opac.pref
241
        my ($data) = GetTab( $input, $tab_name );
241
        my ($data) = GetTab( $input, $tab_name );
242
        my $title = ( keys( %$data ) )[0];
242
        my $title = ( keys( %$data ) )[0];
(-)a/admin/systempreferences.pl (-2 / +2 lines)
Lines 50-56 use C4::Koha; Link Here
50
use C4::Languages qw(getTranslatedLanguages);
50
use C4::Languages qw(getTranslatedLanguages);
51
use C4::ClassSource;
51
use C4::ClassSource;
52
use C4::Output;
52
use C4::Output;
53
use YAML::Syck qw( LoadFile );
53
use YAML::XS;
54
54
55
my %tabsysprefs; #we do no longer need to keep track of a tab per pref (yaml)
55
my %tabsysprefs; #we do no longer need to keep track of a tab per pref (yaml)
56
56
Lines 407-413 sub get_prefs_from_files { Link Here
407
        }
407
        }
408
    };
408
    };
409
    for my $file (@pref_files) {
409
    for my $file (@pref_files) {
410
        my $pref = LoadFile( "$path_pref_en/$file" );
410
        my $pref = YAML::XS::LoadFile( "$path_pref_en/$file" );
411
        for my $tab ( keys %$pref ) {
411
        for my $tab ( keys %$pref ) {
412
            my $content = $pref->{$tab};
412
            my $content = $pref->{$tab};
413
            if ( ref($content) eq 'ARRAY' ) {
413
            if ( ref($content) eq 'ARRAY' ) {
(-)a/misc/admin/koha-preferences (-6 / +5 lines)
Lines 26-34 use C4::Debug; Link Here
26
use C4::Log;
26
use C4::Log;
27
use Getopt::Long;
27
use Getopt::Long;
28
use Pod::Usage;
28
use Pod::Usage;
29
use YAML::Syck qw();
29
use YAML::XS;
30
$YAML::Syck::ImplicitTyping = 1;
30
use Encode;
31
$YAML::Syck::SortKeys = 1;
32
our %NOT_SET_PREFS = map { $_, 1 } qw( Version );
31
our %NOT_SET_PREFS = map { $_, 1 } qw( Version );
33
32
34
=head1 NAME
33
=head1 NAME
Lines 239-247 my %commands = ( Link Here
239
        ) || _print_usage( 1 );
238
        ) || _print_usage( 1 );
240
239
241
        if ( $outfile ) {
240
        if ( $outfile ) {
242
            YAML::Syck::DumpFile( $outfile, GetPreferences() );
241
            YAML::XS::DumpFile( $outfile, GetPreferences() );
243
        } else {
242
        } else {
244
            print YAML::Syck::Dump( GetPreferences() );
243
            print YAML::XS::Dump( Encode::encode_utf8(GetPreferences()) );
245
        }
244
        }
246
    },
245
    },
247
    load => sub {
246
    load => sub {
Lines 252-258 my %commands = ( Link Here
252
            'f' => \$force_version,
251
            'f' => \$force_version,
253
        );
252
        );
254
253
255
        my $preferences = YAML::Syck::LoadFile($infile || \*STDIN);
254
        my $preferences = YAML::XS::LoadFile($infile || \*STDIN);
256
255
257
        die "Expected a YAML mapping" if ( ref($preferences) ne 'HASH' );
256
        die "Expected a YAML mapping" if ( ref($preferences) ne 'HASH' );
258
257
(-)a/misc/cronjobs/cloud-kw.pl (-2 / +2 lines)
Lines 22-28 use strict; Link Here
22
use warnings;
22
use warnings;
23
use diagnostics;
23
use diagnostics;
24
use Carp;
24
use Carp;
25
use YAML::Syck;
25
use YAML::XS;
26
use Pod::Usage;
26
use Pod::Usage;
27
use Getopt::Long;
27
use Getopt::Long;
28
28
Lines 51-57 cronlogaction(); Link Here
51
my @clouds;
51
my @clouds;
52
print "Reading configuration file: $conf\n" if $verbose;
52
print "Reading configuration file: $conf\n" if $verbose;
53
eval {
53
eval {
54
    @clouds = LoadFile( $conf );
54
    @clouds = YAML::XS::LoadFile( $conf );
55
};
55
};
56
croak "Unable to read configuration file: $conf\n" if $@;
56
croak "Unable to read configuration file: $conf\n" if $@;
57
57
(-)a/misc/translator/LangInstaller.pm (-7 / +6 lines)
Lines 22-36 use Modern::Perl; Link Here
22
use C4::Context;
22
use C4::Context;
23
# WARNING: Any other tested YAML library fails to work properly in this
23
# WARNING: Any other tested YAML library fails to work properly in this
24
# script content
24
# script content
25
use YAML::Syck qw( LoadFile DumpFile );
25
# FIXME Really?
26
use YAML::XS;
26
use Locale::PO;
27
use Locale::PO;
27
use FindBin qw( $Bin );
28
use FindBin qw( $Bin );
28
use File::Basename;
29
use File::Basename;
29
use File::Path qw( make_path );
30
use File::Path qw( make_path );
30
use File::Copy;
31
use File::Copy;
31
32
32
$YAML::Syck::ImplicitTyping = 1;
33
34
sub set_lang {
33
sub set_lang {
35
    my ($self, $lang) = @_;
34
    my ($self, $lang) = @_;
36
35
Lines 244-250 sub install_prefs { Link Here
244
    $self->{po} = Locale::PO->load_file_ashash($self->po_filename("-pref.po"), 'utf8');
243
    $self->{po} = Locale::PO->load_file_ashash($self->po_filename("-pref.po"), 'utf8');
245
244
246
    for my $file ( @{$self->{pref_files}} ) {
245
    for my $file ( @{$self->{pref_files}} ) {
247
        my $pref = LoadFile( $self->{path_pref_en} . "/$file" );
246
        my $pref = YAML::XS::LoadFile( $self->{path_pref_en} . "/$file" );
248
247
249
        my $translated_pref = {
248
        my $translated_pref = {
250
            map {
249
            map {
Lines 258-264 sub install_prefs { Link Here
258
257
259
        my $file_trans = $self->{po_path_lang} . "/$file";
258
        my $file_trans = $self->{po_path_lang} . "/$file";
260
        print "Write $file\n" if $self->{verbose};
259
        print "Write $file\n" if $self->{verbose};
261
        DumpFile($file_trans, $translated_pref);
260
        YAML::XS::DumpFile($file_trans, $translated_pref);
262
    }
261
    }
263
}
262
}
264
263
Lines 309-315 sub translate_yaml { Link Here
309
308
310
    my $po_ref  = Locale::PO->load_file_ashash( $po_file );
309
    my $po_ref  = Locale::PO->load_file_ashash( $po_file );
311
310
312
    my $dstyml   = LoadFile( $srcyml );
311
    my $dstyml   = YAML::XS::LoadFile( $srcyml );
313
312
314
    # translate fields in table rows
313
    # translate fields in table rows
315
    my @tables = @{ $dstyml->{'tables'} };
314
    my @tables = @{ $dstyml->{'tables'} };
Lines 402-408 sub install_installer { Link Here
402
                if ( $file =~ /yml$/ ) {
401
                if ( $file =~ /yml$/ ) {
403
                    my $translated_yaml = translate_yaml( $self, $target, "$intradir/$dir/$file" );
402
                    my $translated_yaml = translate_yaml( $self, $target, "$intradir/$dir/$file" );
404
                    open(my $fh, ">:encoding(UTF-8)", "$intradir/$tdir/$file");
403
                    open(my $fh, ">:encoding(UTF-8)", "$intradir/$tdir/$file");
405
                    DumpFile( $fh, $translated_yaml );
404
                    YAML::XS::DumpFile( $fh, $translated_yaml );
406
                    close($fh);
405
                    close($fh);
407
                } else {
406
                } else {
408
                    File::Copy::copy( "$intradir/$dir/$file", "$intradir/$tdir/$file" );
407
                    File::Copy::copy( "$intradir/$dir/$file", "$intradir/$tdir/$file" );
(-)a/misc/translator/xgettext-installer (-4 / +2 lines)
Lines 48-56 use Modern::Perl; Link Here
48
use Getopt::Long;
48
use Getopt::Long;
49
use Locale::PO;
49
use Locale::PO;
50
use Pod::Usage;
50
use Pod::Usage;
51
use YAML::Syck qw(LoadFile);
51
use YAML::XS;
52
53
$YAML::Syck::ImplicitTyping = 1;
54
52
55
my $output = 'messages.pot';
53
my $output = 'messages.pot';
56
my $files_from;
54
my $files_from;
Lines 89-95 my $pot = { Link Here
89
};
87
};
90
88
91
for my $file (@files) {
89
for my $file (@files) {
92
    my $yaml = LoadFile($file);
90
    my $yaml = YAML::XS::LoadFile($file);
93
    my @tables = @{ $yaml->{'tables'} };
91
    my @tables = @{ $yaml->{'tables'} };
94
92
95
    my $tablec = 0;
93
    my $tablec = 0;
(-)a/misc/translator/xgettext-pref (-4 / +2 lines)
Lines 49-57 use File::Basename; Link Here
49
use Getopt::Long;
49
use Getopt::Long;
50
use Locale::PO;
50
use Locale::PO;
51
use Pod::Usage;
51
use Pod::Usage;
52
use YAML::Syck qw(LoadFile);
52
use YAML::XS;
53
54
$YAML::Syck::ImplicitTyping = 1;
55
53
56
my $output = 'messages.pot';
54
my $output = 'messages.pot';
57
my $files_from;
55
my $files_from;
Lines 89-95 my $pot = { Link Here
89
};
87
};
90
88
91
for my $file (@files) {
89
for my $file (@files) {
92
    my $pref = LoadFile($file);
90
    my $pref = YAML::XS::LoadFile($file);
93
    while ( my ($tab, $tab_content) = each %$pref ) {
91
    while ( my ($tab, $tab_content) = each %$pref ) {
94
        add_po(undef, basename($file));
92
        add_po(undef, basename($file));
95
93
(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch/Reset.t (-2 / +1 lines)
Lines 44-50 my $indexes = { Link Here
44
    }
44
    }
45
};
45
};
46
46
47
my $yaml = Test::MockModule->new('YAML::Syck');
47
my $yaml = Test::MockModule->new('YAML::XS');
48
$yaml->mock( 'LoadFile', sub { return $indexes; } );
48
$yaml->mock( 'LoadFile', sub { return $indexes; } );
49
49
50
use_ok('Koha::SearchEngine::Elasticsearch');
50
use_ok('Koha::SearchEngine::Elasticsearch');
51
- 

Return to bug 22824