From 62c48bf9a85e0294b7b32cea438e904e1cd50669 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 28 Dec 2017 15:14:02 +0100 Subject: Show in the phpinfo() is the config is valid This should close #39 --- src/snuffleupagus.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/snuffleupagus.c') diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c index afbd725..b823a87 100644 --- a/src/snuffleupagus.c +++ b/src/snuffleupagus.c @@ -152,6 +152,8 @@ PHP_MINFO_FUNCTION(snuffleupagus) { php_info_print_table_start(); php_info_print_table_row(2, "snuffleupagus support", "enabled"); php_info_print_table_row(2, "Version", PHP_SNUFFLEUPAGUS_VERSION); + php_info_print_table_row(2, "Valid config", + (SNUFFLEUPAGUS_G(is_config_valid) == true)?"yes":"no"); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); } @@ -167,14 +169,18 @@ static PHP_INI_MH(OnUpdateConfiguration) { config_file = strtok(new_value->val, ","); if (sp_parse_config(config_file) != SUCCESS) { + SNUFFLEUPAGUS_G(is_config_valid) = false; return FAILURE; } while ((config_file = strtok(NULL, ","))) { if (sp_parse_config(config_file) != SUCCESS) { + SNUFFLEUPAGUS_G(is_config_valid) = false; return FAILURE; } } + SNUFFLEUPAGUS_G(is_config_valid) = true; + if (SNUFFLEUPAGUS_G(config).config_random->enable) { hook_rand(); } -- cgit v1.3