X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FContext.pm;h=63ad238b120c50e29c153d04d3f07d61747810b9;hb=af14810bac938d81cddcddbfdef3e580514cb25d;hp=5ff2474a06c80279a8093f3727776be3ae8022d4;hpb=6d89c4aeabcd6da8eeed3034f848e029c51c0b23;p=koha_fer diff --git a/C4/Context.pm b/C4/Context.pm index 5ff2474a06..63ad238b12 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -141,6 +141,7 @@ $context = undef; # Initially, no context is set =item KOHAVERSION returns the kohaversion stored in kohaversion.pl file + =cut sub KOHAVERSION { @@ -358,50 +359,29 @@ Cnew> will not return it. =cut -#' -sub config -{ - my $self = shift; - my $var = shift; # The config variable to return - - return undef if !defined($context->{"config"}); - # Presumably $self->{config} might be - # undefined if the config file given to &new - # didn't exist, and the caller didn't bother - # to check the return value. +sub _common_config ($$) { + my $var = shift; + my $term = shift; + return undef if !defined($context->{$term}); + # Presumably $self->{$term} might be + # undefined if the config file given to &new + # didn't exist, and the caller didn't bother + # to check the return value. # Return the value of the requested config variable - return $context->{"config"}->{$var}; + return $context->{$term}->{$var}; } -sub zebraconfig -{ - my $self = shift; - my $var = shift; # The config variable to return - - return undef if !defined($context->{"server"}); - # Presumably $self->{config} might be - # undefined if the config file given to &new - # didn't exist, and the caller didn't bother - # to check the return value. - - # Return the value of the requested config variable - return $context->{"server"}->{$var}; +sub config { + return _common_config($_[1],'config'); } -sub ModZebrations -{ - my $self = shift; - my $var = shift; # The config variable to return - - return undef if !defined($context->{"serverinfo"}); - # Presumably $self->{config} might be - # undefined if the config file given to &new - # didn't exist, and the caller didn't bother - # to check the return value. - - # Return the value of the requested config variable - return $context->{"serverinfo"}->{$var}; +sub zebraconfig { + return _common_config($_[1],'server'); +} +sub ModZebrations { + return _common_config($_[1],'serverinfo'); } + =item preference $sys_preference = C4::Context->preference("some_variable"); @@ -943,6 +923,8 @@ Specifies the configuration file to read. =head1 SEE ALSO +XML::Simple + =head1 AUTHORS Andrew Arensburger