summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/mssql/php_mssql.c20
-rw-r--r--ext/mysql/php_mysql.c22
-rw-r--r--ext/pgsql/pgsql.c28
-rw-r--r--ext/pgsql/php_pgsql.h1
-rw-r--r--main/php_ini.c22
-rw-r--r--main/php_ini.h1
6 files changed, 42 insertions, 52 deletions
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
index dfa3451c5b..d239080eb5 100644
--- a/ext/mssql/php_mssql.c
+++ b/ext/mssql/php_mssql.c
@@ -83,26 +83,6 @@ DLEXPORT zend_module_entry *get_module(void) { return &mssql_module_entry; };
#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING,"MS SQL: A link to the server could not be established"); RETURN_FALSE; } }
-static PHP_INI_DISP(display_link_numbers)
-{
- char *value;
-
- if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
- if (atoi(value)==-1) {
- PUTS("Unlimited");
- } else {
- php_printf("%s", value);
- }
- }
-}
PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("mssql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_persistent, php_mssql_globals, mssql_globals)
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index b2ad027b02..f02382d2fe 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -255,28 +255,6 @@ static PHP_INI_MH(OnMySQLPort)
}
-static PHP_INI_DISP(display_link_numbers)
-{
- char *value;
-
- if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
- if (atoi(value)==-1) {
- PUTS("Unlimited");
- } else {
- php_printf("%s", value);
- }
- }
-}
-
-
PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("mysql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, php_mysql_globals, mysql_globals)
STD_PHP_INI_ENTRY_EX("mysql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, php_mysql_globals, mysql_globals, display_link_numbers)
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index f95e1b0be8..6349802818 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -26,6 +26,7 @@
#endif
#include "php.h"
+#include "php_ini.h"
#include "ext/standard/php_standard.h"
#include "php_pgsql.h"
#include "php_globals.h"
@@ -75,7 +76,7 @@ function_entry pgsql_functions[] = {
};
zend_module_entry pgsql_module_entry = {
- "PostgreSQL", pgsql_functions, PHP_MINIT(pgsql), NULL, PHP_RINIT(pgsql), NULL, NULL, STANDARD_MODULE_PROPERTIES
+ "PostgreSQL", pgsql_functions, PHP_MINIT(pgsql), PHP_MSHUTDOWN(pgsql), PHP_RINIT(pgsql), NULL, NULL, STANDARD_MODULE_PROPERTIES
};
#if COMPILE_DL
@@ -121,18 +122,16 @@ static void _free_result(pgsql_result_handle *pg_result)
efree(pg_result);
}
+PHP_INI_BEGIN()
+ STD_PHP_INI_BOOLEAN("pgsql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, php_pgsql_globals, pgsql_globals)
+ STD_PHP_INI_ENTRY_EX("pgsql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, php_pgsql_globals, pgsql_globals, display_link_numbers)
+ STD_PHP_INI_ENTRY_EX("pgsql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, php_pgsql_globals, pgsql_globals, display_link_numbers)
+PHP_INI_END()
+
+
static void php_pgsql_init_globals(PGLS_D)
{
PGG(num_persistent) = 0;
- if (cfg_get_long("pgsql.allow_persistent",&PGG(allow_persistent))==FAILURE) {
- PGG(allow_persistent)=1;
- }
- if (cfg_get_long("pgsql.max_persistent",&PGG(max_persistent))==FAILURE) {
- PGG(max_persistent)=-1;
- }
- if (cfg_get_long("pgsql.max_links",&PGG(max_links))==FAILURE) {
- PGG(max_links)=-1;
- }
}
PHP_MINIT_FUNCTION(pgsql)
@@ -142,6 +141,8 @@ PHP_MINIT_FUNCTION(pgsql)
#else
php_pgsql_init_globals(PGLS_C);
#endif
+
+ REGISTER_INI_ENTRIES();
le_link = register_list_destructors(_close_pgsql_link,NULL);
le_plink = register_list_destructors(NULL,_close_pgsql_plink);
@@ -158,6 +159,13 @@ PHP_MINIT_FUNCTION(pgsql)
}
+PHP_MSHUTDOWN_FUNCTION(pgsql)
+{
+ UNREGISTER_INI_ENTRIES();
+ return SUCCESS;
+}
+
+
PHP_RINIT_FUNCTION(pgsql)
{
PGLS_FETCH();
diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
index ca4975458c..37dff8235b 100644
--- a/ext/pgsql/php_pgsql.h
+++ b/ext/pgsql/php_pgsql.h
@@ -59,6 +59,7 @@ extern zend_module_entry pgsql_module_entry;
#endif
PHP_MINIT_FUNCTION(pgsql);
+PHP_MSHUTDOWN_FUNCTION(pgsql);
PHP_RINIT_FUNCTION(pgsql);
PHP_FUNCTION(pg_connect);
PHP_FUNCTION(pg_pconnect);
diff --git a/main/php_ini.c b/main/php_ini.c
index 27ed9973a3..5e5c5f8766 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -331,6 +331,28 @@ PHP_INI_DISP(php_ini_color_displayer_cb)
}
+PHP_INI_DISP(display_link_numbers)
+{
+ char *value;
+
+ if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
+ value = ini_entry->orig_value;
+ } else if (ini_entry->value) {
+ value = ini_entry->value;
+ } else {
+ value = NULL;
+ }
+
+ if (value) {
+ if (atoi(value)==-1) {
+ PUTS("Unlimited");
+ } else {
+ php_printf("%s", value);
+ }
+ }
+}
+
+
static int php_ini_displayer(php_ini_entry *ini_entry, int module_number)
{
if (ini_entry->module_number != module_number) {
diff --git a/main/php_ini.h b/main/php_ini.h
index c805347ab8..cc13ee468c 100644
--- a/main/php_ini.h
+++ b/main/php_ini.h
@@ -70,6 +70,7 @@ php_ini_entry *get_ini_entry(char *name, uint name_length);
PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type));
PHPAPI PHP_INI_DISP(php_ini_boolean_displayer_cb);
PHPAPI PHP_INI_DISP(php_ini_color_displayer_cb);
+PHPAPI PHP_INI_DISP(display_link_numbers);
#define PHP_INI_BEGIN() static php_ini_entry ini_entries[] = {
#define PHP_INI_END() { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } };