php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #61607
Patch geoip_custom_directory_patch_rev2 revision 2012-04-18 01:01 UTC by tiago dot peralta at sapo dot pt
Patch geoip_custom_directory_patch revision 2012-04-18 00:18 UTC by tiago dot peralta at sapo dot pt

Patch geoip_custom_directory_patch_rev2 for geoip Bug #61607

Patch version 2012-04-18 01:01 UTC

Return to Bug #61607 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: tiago.peralta@sapo.pt

--- geoip.c	1970-01-01 10:13:08.000000000 +0100
+++ geoip.new2	2012-04-18 02:00:41.000000000 +0100
@@ -85,11 +85,34 @@
 ZEND_GET_MODULE(geoip)
 #endif
 
+/* {{{ PHP_INI_MH 
+ */
+static PHP_INI_MH(OnUpdateDirectory)
+{
+    char* new_val = new_value;
+    
+    struct stat st;
+    if( stat( new_val, &st ) == 0)
+    {
+        GEOIP_G(custom_directory) = new_value;
+	if (GeoIPDBFileName != NULL) 
+        {
+		free(GeoIPDBFileName);
+		GeoIPDBFileName = NULL;
+	}
+        GeoIP_setup_custom_directory(GEOIP_G(custom_directory));
+        _GeoIP_setup_dbfilename();
+        return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+    }
+    
+}
+/* }}} */
+
 /* {{{ PHP_INI
  */
 PHP_INI_BEGIN()
 #ifdef HAVE_CUSTOM_DIRECTORY
-	STD_PHP_INI_ENTRY("geoip.custom_directory", NULL, PHP_INI_ALL, OnUpdateString, custom_directory, zend_geoip_globals, geoip_globals)
+	STD_PHP_INI_ENTRY("geoip.custom_directory", NULL, PHP_INI_ALL, OnUpdateDirectory, custom_directory, zend_geoip_globals, geoip_globals)
 #endif
 PHP_INI_END()
 /* }}} */
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 05:01:27 2024 UTC