]> granicus.if.org Git - php/commitdiff
Apache php_ini support
authorZeev Suraski <zeev@php.net>
Fri, 9 Apr 1999 21:15:07 +0000 (21:15 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 9 Apr 1999 21:15:07 +0000 (21:15 +0000)
main/php_ini.c
mod_php3.c

index 4a329a9717d8409805953b2429fcaa7fd4b278b4..e57db71a694e797777e64f847e4d1b0f2dd89484 100644 (file)
@@ -58,6 +58,8 @@ static int php_restore_ini_entry_cb(php_ini_entry *ini_entry)
                ini_entry->value = ini_entry->orig_value;
                ini_entry->value_length = ini_entry->orig_value_length;
                ini_entry->modified = 0;
+               ini_entry->orig_value = NULL;
+               ini_entry->orig_value_length = 0;
        }
        return 0;
 }
@@ -109,6 +111,10 @@ int php_register_ini_entries(php_ini_entry *ini_entry, int module_number)
                                hashed_ini_entry->value = default_value->value.str.val;
                                hashed_ini_entry->value_length = default_value->value.str.len;
                        }
+               } else {
+                       if (hashed_ini_entry->on_modify) {
+                               hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg);
+                       }
                }
                hashed_ini_entry->modified = 0;
                p++;
index 802b967f4d27df4620e1dc157f62240b8b62ad65..c14c2d4ba1c6c85f697952ece8ff076cafa57492 100644 (file)
 #include "http_log.h"
 #endif
 
+
+/* These are taken out of php_ini.h
+ * they must be updated if php_ini.h changes!
+ */
+#define PHP_INI_USER    (1<<0)
+#define PHP_INI_PERDIR  (1<<1)
+#define PHP_INI_SYSTEM  (1<<2)
+
 #include "util_script.h"
 
 #include "php_version.h"
@@ -384,6 +392,36 @@ char *php3flaghandler(cmd_parms * cmd, php3_ini_structure * conf, int val)
        return NULL;
 }
 
+
+#if MODULE_MAGIC_NUMBER > 19961007
+#define CONST_PREFIX const
+#else
+#define CONST_PREFIX
+#endif
+
+CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, php3_ini_structure *conf, char *arg1, char *arg2)
+{
+       php_alter_ini_entry(arg1, strlen(arg1)+1, arg2, strlen(arg2)+1, PHP_INI_PERDIR);
+       return NULL;
+}
+
+
+CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, php3_ini_structure *conf, char *arg1, char *arg2)
+{
+       char bool_val[2];
+
+       if (!strcmp(arg2, "On")) {
+               bool_val[0] = '1';
+       } else {
+               bool_val[0] = '0';
+       }
+       bool_val[1] = 0;
+       
+       php_alter_ini_entry(arg1, strlen(arg1)+1, bool_val, 2, PHP_INI_PERDIR);
+       return NULL;
+}
+
+
 #if MODULE_MAGIC_NUMBER > 19961007
 const char *php3take1handler(cmd_parms * cmd, php3_ini_structure * conf, char *arg)
 {
@@ -546,6 +584,8 @@ handler_rec php3_handlers[] =
 
 command_rec php3_commands[] =
 {
+       {"php4_directive",              php_apache_value_handler, NULL, OR_OPTIONS, TAKE2, "PHP Value Modifier"},
+       {"php4_flag",                   php_apache_flag_handler, NULL, OR_OPTIONS, TAKE2, "PHP Flag Modifier"},
        {"php3_error_reporting", php3take1handler, (void *)0, OR_OPTIONS, TAKE1, "error reporting level"},
        {"php3_doc_root", php3take1handler, (void *)1, ACCESS_CONF|RSRC_CONF, TAKE1, "directory"}, /* not used yet */
        {"php3_user_dir", php3take1handler, (void *)2, ACCESS_CONF|RSRC_CONF, TAKE1, "user directory"}, /* not used yet */