@@ -, +, @@ --- C4/Context.pm | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) --- a/C4/Context.pm +++ a/C4/Context.pm @@ -84,6 +84,7 @@ BEGIN { use DBI; use ZOOM; use XML::Simple; +use YAML::Syck qw(LoadFile); use C4::Boolean; use C4::Debug; use POSIX (); @@ -169,7 +170,7 @@ environment variable to the pathname of a configuration file to use. # # The first entry that refers to a readable file is used. -use constant CONFIG_FNAME => "/etc/koha/koha-conf.xml"; +use constant CONFIG_FNAME => "/etc/koha/koha-conf.yaml"; # Default config file, if none is specified my $INSTALLED_CONFIG_FNAME = '__KOHA_CONF_DIR__/koha-conf.xml'; @@ -232,6 +233,12 @@ sub read_config_file { # Pass argument naming config file to read return $koha; # Return value: ref-to-hash holding the configuration } +sub read_yaml_config_file { + my $koha; + $koha->{'config'} = YAML::Syck::LoadFile(shift); + return $koha; +} + # db_scheme2dbi # Translates the full text name of a database into de appropiate dbi name # @@ -310,7 +317,11 @@ sub new { } } # Load the desired config file. - $self = read_config_file($conf_fname); + if ($conf_fname =~ /xml$/) { + $self = read_config_file($conf_fname); + } elsif ($conf_fname =~ /yaml$/) { + $self = read_yaml_config_file($conf_fname); + } $self->{"config_file"} = $conf_fname; warn "read_config_file($conf_fname) returned undef" if !defined($self->{"config"}); --