confparser: Split loading of config into own function

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Johannes Löthberg 2015-06-14 15:08:38 +02:00 committed by Lukas Fleischer
parent 3bc4496328
commit 9ef7de0569

View file

@ -1,11 +1,16 @@
<?php <?php
function config_get($section, $key) { function config_load() {
global $AUR_CONFIG; global $AUR_CONFIG;
if (!isset($AUR_CONFIG)) { if (!isset($AUR_CONFIG)) {
$AUR_CONFIG = parse_ini_file("../../conf/config", true, INI_SCANNER_RAW); $AUR_CONFIG = parse_ini_file("../../conf/config", true, INI_SCANNER_RAW);
} }
}
function config_get($section, $key) {
global $AUR_CONFIG;
config_load();
return $AUR_CONFIG[$section][$key]; return $AUR_CONFIG[$section][$key];
} }