Code

make this work on recent php4 versions -- Bernhard Fischer
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 30 May 2007 09:28:30 +0000 (09:28 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 30 May 2007 09:28:30 +0000 (09:28 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1090 a5681a0c-68f1-0310-ab6d-d61299d08faa

contrib/php4/examples/rrd_fetch.php
contrib/php4/php_rrdtool.h
contrib/php4/rrdtool.c

index 470fb9f8720c9ab01252e27c2a37f3c88f7a951f..3b17ea1e621b8204f7d33f9c4fe1306e415a603d 100644 (file)
@@ -42,7 +42,7 @@
       for($i = 0; $i < count($ret[data]); $i++)
       {
           $tmp = $ret[data][$i];
-          echo "$hi\n";
+          echo "$tmp\n";
       }
   }
   else
index 7bc19983bc52101206fa7c91dc93ae18c3d516dd..756c4bc40ff388424c67f4c81ab3c268b3083934 100644 (file)
 #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
index 87b9fd2663cb86c82c54b6959bbb5a095ed431d3..54ddedb9e58ad0a2c57f5b8cdb7380566aada5c3 100644 (file)
@@ -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);