Koha::Config - Read Koha configuration file
use Koha::Config; my $config = Koha::Config->get_instance; my $database = $config->get('database'); my $serverinfo = $config->get('biblioserver', 'serverinfo'); my $otherconfig = Koha::Config->get_instance('/path/to/other/koha-conf.xml');
Koha::Config is a helper module for reading configuration variables from the main Koha configuration file ($KOHA_CONF)
$config = Koha::Config->get_instance; $config = Koha::Config->get_instance($file);
Reads $file
and returns the corresponding Koha::Config
object.
If $file
is not given (or undef) it defaults to the result of Koha::Config->guess_koha_conf
.
Multiple calls with the same arguments will return the same object, and the file will be read only the first time.
$config = Koha::Config->read_from_file($file);
Reads $file
and returns the corresponding Koha::Config
object.
Unlike get_instance
, this method will read the file at every call, so use it carefully. In most cases, you should use get_instance
instead.
$file = Koha::Config->guess_koha_conf;
Returns the path to Koha main configuration file.
Koha's main configuration file koha-conf.xml is searched for according to this priority list:
The first entry that refers to a readable file is used.
$value = $config->get($key); $value = $config->get($key, $section);
Returns the configuration entry corresponding to $key
and $section
. The returned value can be a string, an arrayref or a hashref. If $key
is not found, it returns undef.
$section
can be one of 'listen', 'server', 'serverinfo', 'config'. If not given, $section
defaults to 'config'.
$timezone = $config->timezone Returns the configured timezone. If not configured or invalid, it returns 'local'.