summaryrefslogtreecommitdiff
path: root/src/snuffleupagus.c
diff options
context:
space:
mode:
authorjvoisin2017-12-28 15:14:02 +0100
committerjvoisin2017-12-28 15:14:02 +0100
commit62c48bf9a85e0294b7b32cea438e904e1cd50669 (patch)
tree7c7e88debd8b6873fe444c6ed43a674827cc8c04 /src/snuffleupagus.c
parentb21139d922268251a19dd16f98248551863fe3e5 (diff)
Show in the phpinfo() is the config is valid
This should close #39
Diffstat (limited to 'src/snuffleupagus.c')
-rw-r--r--src/snuffleupagus.c6
1 files changed, 6 insertions, 0 deletions
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) {
152 php_info_print_table_start(); 152 php_info_print_table_start();
153 php_info_print_table_row(2, "snuffleupagus support", "enabled"); 153 php_info_print_table_row(2, "snuffleupagus support", "enabled");
154 php_info_print_table_row(2, "Version", PHP_SNUFFLEUPAGUS_VERSION); 154 php_info_print_table_row(2, "Version", PHP_SNUFFLEUPAGUS_VERSION);
155 php_info_print_table_row(2, "Valid config",
156 (SNUFFLEUPAGUS_G(is_config_valid) == true)?"yes":"no");
155 php_info_print_table_end(); 157 php_info_print_table_end();
156 DISPLAY_INI_ENTRIES(); 158 DISPLAY_INI_ENTRIES();
157} 159}
@@ -167,14 +169,18 @@ static PHP_INI_MH(OnUpdateConfiguration) {
167 169
168 config_file = strtok(new_value->val, ","); 170 config_file = strtok(new_value->val, ",");
169 if (sp_parse_config(config_file) != SUCCESS) { 171 if (sp_parse_config(config_file) != SUCCESS) {
172 SNUFFLEUPAGUS_G(is_config_valid) = false;
170 return FAILURE; 173 return FAILURE;
171 } 174 }
172 while ((config_file = strtok(NULL, ","))) { 175 while ((config_file = strtok(NULL, ","))) {
173 if (sp_parse_config(config_file) != SUCCESS) { 176 if (sp_parse_config(config_file) != SUCCESS) {
177 SNUFFLEUPAGUS_G(is_config_valid) = false;
174 return FAILURE; 178 return FAILURE;
175 } 179 }
176 } 180 }
177 181
182 SNUFFLEUPAGUS_G(is_config_valid) = true;
183
178 if (SNUFFLEUPAGUS_G(config).config_random->enable) { 184 if (SNUFFLEUPAGUS_G(config).config_random->enable) {
179 hook_rand(); 185 hook_rand();
180 } 186 }