}
-static int php_restore_ini_entry_cb(php_ini_entry *ini_entry)
+static int php_restore_ini_entry_cb(php_ini_entry *ini_entry, int stage)
{
if (ini_entry->modified) {
if (ini_entry->on_modify) {
- ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3);
+ ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage);
}
efree(ini_entry->value);
ini_entry->value = ini_entry->orig_value;
int php_ini_rshutdown()
{
- zend_hash_apply(&known_directives, (int (*)(void *)) php_restore_ini_entry_cb);
+ zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_restore_ini_entry_cb, (void *) PHP_INI_STAGE_DEACTIVATE);
return SUCCESS;
}
return FAILURE;
}
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_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3);
+ hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, PHP_INI_STAGE_STARTUP);
}
if ((default_value=cfg_get_entry(p->name, p->name_length))) {
if (!hashed_ini_entry->on_modify
- || hashed_ini_entry->on_modify(hashed_ini_entry, default_value->value.str.val, default_value->value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3)==SUCCESS) {
+ || hashed_ini_entry->on_modify(hashed_ini_entry, default_value->value.str.val, default_value->value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, PHP_INI_STAGE_STARTUP)==SUCCESS) {
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_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3);
+ hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, PHP_INI_STAGE_STARTUP);
}
}
hashed_ini_entry->modified = 0;
}
-static int php_ini_refresh_cache(php_ini_entry *p)
+static int php_ini_refresh_cache(php_ini_entry *p, int stage)
{
if (p->on_modify) {
- p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3);
+ p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage);
}
return 0;
}
-PHPAPI void php_ini_refresh_caches()
+PHPAPI void php_ini_refresh_caches(int stage)
{
- zend_hash_apply(&known_directives, (int (*)(void *)) php_ini_refresh_cache);
+ zend_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_ini_refresh_cache, (void *) stage);
}
-PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type)
+PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage)
{
php_ini_entry *ini_entry;
char *duplicate;
duplicate = estrndup(new_value, new_value_length);
if (!ini_entry->on_modify
- || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3)==SUCCESS) {
+ || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage)==SUCCESS) {
if (!ini_entry->modified) {
ini_entry->orig_value = ini_entry->value;
ini_entry->orig_value_length = ini_entry->value_length;
}
-PHPAPI int php_restore_ini_entry(char *name, uint name_length)
+PHPAPI int php_restore_ini_entry(char *name, uint name_length, int stage)
{
php_ini_entry *ini_entry;
return FAILURE;
}
- php_restore_ini_entry_cb(ini_entry);
+ php_restore_ini_entry_cb(ini_entry, stage);
return SUCCESS;
}
typedef struct _php_ini_entry php_ini_entry;
-#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3)
+#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage)
#define PHP_INI_DISP(name) void name(php_ini_entry *ini_entry, int type)
struct _php_ini_entry {
PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number);
PHPAPI void php_unregister_ini_entries(int module_number);
-PHPAPI void php_ini_refresh_caches(void);
-PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type);
-PHPAPI int php_restore_ini_entry(char *name, uint name_length);
+PHPAPI void php_ini_refresh_caches(int stage);
+PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage);
+PHPAPI int php_restore_ini_entry(char *name, uint name_length, int stage);
PHPAPI void display_ini_entries(zend_module_entry *module);
PHPAPI long php_ini_long(char *name, uint name_length, int orig);
#define PHP_INI_DISPLAY_ORIG 1
#define PHP_INI_DISPLAY_ACTIVE 2
+#define PHP_INI_STAGE_STARTUP (1<<0)
+#define PHP_INI_STAGE_SHUTDOWN (1<<1)
+#define PHP_INI_STAGE_ACTIVATE (1<<2)
+#define PHP_INI_STAGE_DEACTIVATE (1<<3)
+#define PHP_INI_STAGE_RUNTIME (1<<4)
+
#endif /* _PHP_INI_H */