[aur-dev] [PATCH 2/3] confparser: Add function for checking if config key exists

Lukas Fleischer lfleischer at archlinux.org
Sun Jun 14 12:45:47 UTC 2015


On Sun, 14 Jun 2015 at 13:32:38, Johannes Löthberg wrote:
> Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
> ---
>  web/lib/confparser.inc.php | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/web/lib/confparser.inc.php b/web/lib/confparser.inc.php
> index ae862d3..09fee5a 100644
> --- a/web/lib/confparser.inc.php
> +++ b/web/lib/confparser.inc.php
> @@ -23,3 +23,10 @@ function config_get_bool($section, $key) {
>         $val = strtolower(config_get($section, $key));
>         return ($val == 'yes' || $val == 'true' || $val == '1');
>  }
> +
> +function config_key_exists($key) {

I'd rather call this config_section_exists() to make it clear that it
checks for a section.

> +       global $AUR_CONFIG;
> +       config_load();
> +
> +       return array_key_exists($key, $AUR_CONFIG);
> +}
> -- 
> 2.4.2


More information about the aur-dev mailing list