From 4639c2a5cfed13946dbc1134c8474446f0b88ae1 Mon Sep 17 00:00:00 2001 From: oetiker Date: Wed, 30 May 2007 09:28:30 +0000 Subject: [PATCH] make this work on recent php4 versions -- Bernhard Fischer git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1090 a5681a0c-68f1-0310-ab6d-d61299d08faa --- contrib/php4/examples/rrd_fetch.php | 2 +- contrib/php4/php_rrdtool.h | 4 ++++ contrib/php4/rrdtool.c | 28 +++++++++++++++++++--------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/contrib/php4/examples/rrd_fetch.php b/contrib/php4/examples/rrd_fetch.php index 470fb9f8..3b17ea1e 100644 --- a/contrib/php4/examples/rrd_fetch.php +++ b/contrib/php4/examples/rrd_fetch.php @@ -42,7 +42,7 @@ for($i = 0; $i < count($ret[data]); $i++) { $tmp = $ret[data][$i]; - echo "$hi\n"; + echo "$tmp\n"; } } else diff --git a/contrib/php4/php_rrdtool.h b/contrib/php4/php_rrdtool.h index 7bc19983..756c4bc4 100644 --- a/contrib/php4/php_rrdtool.h +++ b/contrib/php4/php_rrdtool.h @@ -12,6 +12,10 @@ #ifndef _PHP4_RRDTOOL_H #define _PHP4_RRDTOOL_H +#ifdef HAVE_CONFIG_H +#include "php_config.h" +#endif + #if COMPILE_DL #undef HAVE_RRDTOOL #define HAVE_RRDTOOL 1 diff --git a/contrib/php4/rrdtool.c b/contrib/php4/rrdtool.c index 87b9fd26..54ddedb9 100644 --- a/contrib/php4/rrdtool.c +++ b/contrib/php4/rrdtool.c @@ -34,14 +34,21 @@ function_entry rrdtool_functions[] = { }; zend_module_entry rrdtool_module_entry = { - "RRDTool", - rrdtool_functions, - NULL, - NULL, - NULL, - NULL, - PHP_MINFO(rrdtool), - STANDARD_MODULE_PROPERTIES, +#if ZEND_EXTENSION_API_NO >= 220050617 + STANDARD_MODULE_HEADER_EX, NULL, + NULL, /* dependencies */ +#else + STANDARD_MODULE_HEADER, +#endif + "RRDTool", /* name */ + rrdtool_functions, /* functions */ + NULL, /* module_startup_func */ + NULL, /* module_shutdown_func */ + NULL, /* request_startup_func */ + NULL, /* request_shutdown_func */ + PHP_MINFO(rrdtool), /* info_func */ + NO_VERSION_YET, + STANDARD_MODULE_PROPERTIES }; #ifdef COMPILE_DL_RRDTOOL @@ -269,6 +276,7 @@ PHP_FUNCTION(rrd_graph) zval *p_calcpr; HashTable *args_arr; int i, xsize, ysize, argc; + double ymin, ymax; char **argv, **calcpr; @@ -316,11 +324,13 @@ PHP_FUNCTION(rrd_graph) } optind = 0; opterr = 0; - if ( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize) != -1 ) + if ( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize, NULL, &ymin, &ymax) != -1 ) { array_init(return_value); add_assoc_long(return_value, "xsize", xsize); add_assoc_long(return_value, "ysize", ysize); + add_assoc_double(return_value, "ymin", ymin); + add_assoc_double(return_value, "ymax", ymax); MAKE_STD_ZVAL(p_calcpr); array_init(p_calcpr); -- 2.30.2