Add php abi check (#247339) and bump to latest rrdtool svn

This commit is contained in:
Jarod Wilson 2007-07-11 01:56:01 +00:00
parent 256b30c6c7
commit dcf62face0
4 changed files with 18 additions and 888 deletions

View File

@ -1,12 +1,3 @@
rrdtool-1.2.12.tar.gz
rrdtool-1.2.13.tar.gz
php4-svn839.tar.gz
rrdtool-1.2.15.tar.gz
rrdtool-1.2.17.tar.gz
rrdtool-1.2.18.tar.gz
rrdtool-1.2.19.tar.gz
rrdtool-1.2.21.tar.gz
rrdtool-1.2.22.tar.gz
rrdtool-1.2.23.tar.gz
rrdtool-1.2.999-r1127.tar.gz
php4-r1127.tar.gz
rrdtool-1.2.999-r1144.tar.gz
php4-r1144.tar.gz

View File

@ -1,874 +1,3 @@
diff -Naurp php4/config.m4 php4.updated/config.m4
--- php4/config.m4 2007-06-15 10:37:49.000000000 -0400
+++ php4.updated/config.m4 2007-06-15 10:42:38.000000000 -0400
@@ -1,24 +1,96 @@
-dnl $Id: config.m4 9 2001-02-25 22:30:32Z oetiker $
+dnl $Id$
+dnl config.m4 for extension rrdtool
-PHP_ARG_WITH(rrdtool, for RRDTool support,
-[ --with-rrdtool[=DIR] Include RRDTool support. DIR is the rrdtool
- install directory.])
+dnl Comments in this file start with the string 'dnl'.
+dnl Remove where necessary. This file will not work
+dnl without editing.
+
+dnl
+dnl Checks for the configure options
+dnl
+
+PHP_ARG_WITH(rrdtool, for rrdtool support,
+[ --with-rrdtool[=DIR] Include rrdtool support (requires rrdtool >= 1.0.49).])
if test "$PHP_RRDTOOL" != "no"; then
- for i in /usr/local /usr /opt/rrdtool /usr/local/rrdtool $PHP_RRDTOOL; do
- if test -f $i/include/rrd.h; then
- RRDTOOL_DIR=$i
- fi
- done
- if test -z "$RRDTOOL_DIR"; then
- AC_MSG_ERROR(Please reinstall rrdtool, or specify a directory - I cannot find rrd.h)
+ if test "$PHP_RRDTOOL" != "yes"; then
+ AC_MSG_CHECKING(if rrdtool specified path is valid)
+ if test -r $PHP_RRDTOOL/include/rrd.h && test -f $PHP_RRDTOOL/lib/librrd.$SHLIB_SUFFIX_NAME -o -f $PHP_RRDTOOL/lib/librrd.a; then # path given as parameter
+ RRDTOOL_DIR=$PHP_RRDTOOL
+ RRDTOOL_INCDIR=$PHP_RRDTOOL/include
+ RRDTOOL_LIBDIR=$PHP_RRDTOOL/lib
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([The specified RRDTool path is Invalid or the installation is incomplete
+ Please specify another path or reinstall the rrdtool distribution])
+ fi
+ else
+ dnl Header path
+ AC_MSG_CHECKING([for rrdtool header files in default path])
+ for i in /usr/local/rrdtool /usr/local /usr /opt ""; do
+ test -r $i/include/rrd.h && RRDTOOL_DIR=$i && RRDTOOL_INCDIR=$i/include
+ done
+ if test -z "$RRDTOOL_INCDIR"; then
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([Please reinstall the rrdtool distribution])
+ else
+ AC_MSG_RESULT(found in $RRDTOOL_INCDIR)
+ fi
+ dnl Library path
+ AC_MSG_CHECKING([for rrdtool library files in default path])
+ for i in librrd.$SHLIB_SUFFIX_NAME librrd.a; do
+ test -f $RRDTOOL_DIR/lib/$i && RRDTOOL_LIBDIR=$RRDTOOL_DIR/lib
+ done
+ if test -z "$RRDTOOL_LIBDIR"; then
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([Please reinstall the rrdtool distribution])
+ else
+ AC_MSG_RESULT(found in $RRDTOOL_LIBDIR)
+ fi
fi
- AC_ADD_INCLUDE($RRDTOOL_DIR/include)
- AC_ADD_LIBRARY_WITH_PATH(rrd, $RRDTOOL_DIR/lib, RRDTOOL_SHARED_LIBADD)
- PHP_SUBST(RRDTOOL_SHARED_LIBADD)
- AC_DEFINE(HAVE_RRDTOOL,1,[ ])
+dnl Finish the setup
- PHP_EXTENSION(rrdtool, $ext_shared)
+ RRD_H_PATH="$RRDTOOL_INCDIR/rrd.h"
+ PHP_RRDTOOL_DIR=$RRDTOOL_DIR
+ PHP_ADD_INCLUDE($RRDTOOL_INCDIR)
+
+ PHP_CHECK_LIBRARY(rrd, rrd_create,
+ [],[
+ PHP_CHECK_LIBRARY(rrd, rrd_create,
+ [],[
+ AC_MSG_ERROR([wrong rrd lib version or lib not found])
+ ],[
+ -L$RRDTOOL_LIBDIR -ldl
+ ])
+ ],[
+ -L$RRDTOOL_LIBDIR -ldl
+ ])
+
+ AC_MSG_CHECKING([rrdtool version])
+ AC_TRY_COMPILE([
+#include <$RRD_H_PATH>
+ ], [int main() {
+ double some_variable;
+ some_variable = rrd_version();
+ }
+ ], [
+ AC_MSG_RESULT([1.2.x])
+ ac_cv_rrdversion=yes
+ ], [
+ AC_MSG_RESULT([1.0.x])
+ ac_cv_rrdversion=no
+ ])
+
+ if test "$ac_cv_rrdversion" = yes; then
+ AC_DEFINE(HAVE_RRD_12X, 1, [Whether you have rrd_verion])
+ fi
+
+ PHP_ADD_LIBRARY_WITH_PATH(rrd, $RRDTOOL_LIBDIR, RRDTOOL_SHARED_LIBADD)
+
+ PHP_NEW_EXTENSION(rrdtool, rrdtool.c, $ext_shared)
+ PHP_SUBST(RRDTOOL_SHARED_LIBADD)
+ AC_DEFINE(HAVE_RRDTOOL, 1, [ ])
fi
diff -Naurp php4/configure php4.updated/configure
--- php4/configure 2007-06-15 10:37:49.000000000 -0400
+++ php4.updated/configure 2007-06-15 10:42:38.000000000 -0400
@@ -1159,6 +1159,7 @@ if test "$PHP_RRDTOOL" != "no"; then
cat >> confdefs.h <<\EOF
#define HAVE_RRDTOOL 1
+#define HAVE_RRD_12X 1
EOF
diff -Naurp php4/ltconfig php4.updated/ltconfig
--- php4/ltconfig 2007-06-15 10:37:49.000000000 -0400
+++ php4.updated/ltconfig 2007-06-15 10:42:38.000000000 -0400
@@ -1247,7 +1247,8 @@ EOF
if test "$ld_shlibs" = yes; then
runpath_var=LD_RUN_PATH
- hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+ #hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+ hardcode_libdir_flag_spec=''
export_dynamic_flag_spec='${wl}--export-dynamic'
case $host_os in
cygwin* | mingw*)
diff -Naurp php4/php_rrdtool.h php4.updated/php_rrdtool.h
--- php4/php_rrdtool.h 2007-06-15 10:37:49.000000000 -0400
+++ php4.updated/php_rrdtool.h 2007-06-15 10:46:24.000000000 -0400
@@ -9,42 +9,61 @@
*
*/
-#ifndef _PHP4_RRDTOOL_H
-#define _PHP4_RRDTOOL_H
+#ifndef _PHP_RRDTOOL_H
+#define _PHP_RRDTOOL_H
#ifdef HAVE_CONFIG_H
#include "php_config.h"
#endif
-#if COMPILE_DL
-#undef HAVE_RRDTOOL
-#define HAVE_RRDTOOL 1
+#ifdef PHP_WIN32
+#ifdef PHP_RRDTOOL_EXPORTS
+#define PHP_RRDTOOL_API __declspec(dllexport)
+#else
+#define PHP_RRDTOOL_API __declspec(dllimport)
#endif
-#ifndef DLEXPORT
-#define DLEXPORT
+#else
+#define PHP_RRDTOOL_API
#endif
#if HAVE_RRDTOOL
-PHP_MINFO_FUNCTION(rrdtool);
-
extern zend_module_entry rrdtool_module_entry;
#define rrdtool_module_ptr &rrdtool_module_entry
-#define phpext_rrdtool_ptr rrdtool_module_ptr
+#ifdef ZTS
+#include "TSRM.h"
+#endif
+
+#define RRDTOOL_LOGO_GUID "PHP25B1F7E8-916B-11D9-9A54-000A95AE92DA"
+
+/* If you declare any globals in php_rrdtool.h uncomment this:
+ZEND_BEGIN_MODULE_GLOBALS(rrdtool)
+
+ZEND_END_MODULE_GLOBALS(rrdtool)
+ */
+
+PHP_MINIT_FUNCTION(rrdtool);
+PHP_MSHUTDOWN_FUNCTION(rrdtool);
+PHP_MINFO_FUNCTION(rrdtool);
+
+PHP_FUNCTION(rrd_graph);
+PHP_FUNCTION(rrd_fetch);
PHP_FUNCTION(rrd_error);
PHP_FUNCTION(rrd_clear_error);
PHP_FUNCTION(rrd_update);
PHP_FUNCTION(rrd_last);
PHP_FUNCTION(rrd_create);
-PHP_FUNCTION(rrd_graph);
-PHP_FUNCTION(rrd_fetch);
+PHP_FUNCTION(rrdtool_info);
+PHP_FUNCTION(rrdtool_logo_guid);
#else
-#define phpext_rrdtool_ptr NULL
+#define rrdtool_module_ptr NULL
#endif /* HAVE_RRDTOOL */
-#endif /* _PHP4_RRDTOOL_H */
+#define phpext_rrdtool_ptr rrdtool_module_ptr
+
+#endif /* _PHP_RRDTOOL_H */
diff -Naurp php4/rrdtool.c php4.updated/rrdtool.c
--- php4/rrdtool.c 2007-06-15 10:37:49.000000000 -0400
+++ php4.updated/rrdtool.c 2007-06-15 10:59:53.000000000 -0400
@@ -1,6 +1,6 @@
/*
*
- * php4_rrdtool.c
+ * php_rrdtool.c
*
* PHP interface to RRD Tool. (for php4/zend)
*
@@ -9,6 +9,8 @@
* iBIZ Technology Corp, SkyLynx / Inficad Communications
* 2/12/2000 & 7/18/2000
*
+ * Jeffrey Wheat <jeff@cetlink.net> - 10/01/2002
+ * - Fixed to build with php-4.2.3
*
* See README, INSTALL, and USAGE files for more details.
*
@@ -16,20 +18,37 @@
*
*/
+/* PHP Includes */
#include "php.h"
-#include "rrd.h"
+#include "php_logos.h"
+#include "ext/standard/info.h"
+#include "SAPI.h"
+
+/* rrdtool includes */
#include "php_rrdtool.h"
+#include "rrdtool_logo.h"
+#include <rrd.h>
+
+#ifdef HAVE_CONFIG_H
+#include "php_config.h"
+#endif
#if HAVE_RRDTOOL
+/* If you declare any globals in php_rrdtool.h uncomment this:
+ZEND_DECLARE_MODULE_GLOBALS(rrdtool)
+ */
+
function_entry rrdtool_functions[] = {
- PHP_FE(rrd_error, NULL)
- PHP_FE(rrd_clear_error, NULL)
PHP_FE(rrd_graph, NULL)
- PHP_FE(rrd_last, NULL)
PHP_FE(rrd_fetch, NULL)
+ PHP_FE(rrd_error, NULL)
+ PHP_FE(rrd_clear_error, NULL)
PHP_FE(rrd_update, NULL)
+ PHP_FE(rrd_last, NULL)
PHP_FE(rrd_create, NULL)
+ PHP_FE(rrdtool_info, NULL)
+ PHP_FE(rrdtool_logo_guid, NULL)
{NULL, NULL, NULL}
};
@@ -40,10 +59,10 @@ zend_module_entry rrdtool_module_entry =
#else
STANDARD_MODULE_HEADER,
#endif
- "RRDTool", /* name */
+ "rrdtool", /* name */
rrdtool_functions, /* functions */
- NULL, /* module_startup_func */
- NULL, /* module_shutdown_func */
+ PHP_MINIT(rrdtool), /* module_startup_func */
+ PHP_MSHUTDOWN(rrdtool), /* module_shutdown_func */
NULL, /* request_startup_func */
NULL, /* request_shutdown_func */
PHP_MINFO(rrdtool), /* info_func */
@@ -55,220 +74,49 @@ zend_module_entry rrdtool_module_entry =
ZEND_GET_MODULE(rrdtool)
#endif
-PHP_MINFO_FUNCTION(rrdtool)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "rrdtool support", "enabled");
- php_info_print_table_end();
-}
-
-//PHP_MINIT_FUNCTION(rrdtool)
-//{
-// return SUCCESS;
-//}
-
-
-/* {{{ proto string rrd_error(void)
- Get the error message set by the last rrd tool function call */
+#ifdef COMPILE_DL_RRDTOOL
+#define PHP_RRD_VERSION_STRING "1.2.x extension"
+#else
+#define PHP_RRD_VERSION_STRING "1.2.x bundled"
+#endif
-PHP_FUNCTION(rrd_error)
+/* {{{ PHP_MINIT_FUNCTION */
+PHP_MINIT_FUNCTION(rrdtool)
{
- char *msg;
-
- if ( rrd_test_error() )
- {
- msg = rrd_get_error();
-
- RETVAL_STRING(msg, 1);
- rrd_clear_error();
- }
- else
- return;
+ php_register_info_logo(RRDTOOL_LOGO_GUID , "image/gif", rrdtool_logo , sizeof(rrdtool_logo));
+
+ return SUCCESS;
}
/* }}} */
-
-
-/* {{{ proto void rrd_clear_error(void)
- Clear the error set by the last rrd tool function call */
-
-PHP_FUNCTION(rrd_clear_error)
+/* {{{ PHP_MSHUTDOWN_FUNCTION */
+PHP_MSHUTDOWN_FUNCTION(rrdtool)
{
- if ( rrd_test_error() )
- rrd_clear_error();
-
- return;
+ php_unregister_info_logo(RRDTOOL_LOGO_GUID);
+
+ return SUCCESS;
}
/* }}} */
-
-
-/* {{{ proto int rrd_update(string file, string opt)
- Update an RRD file with values specified */
-
-PHP_FUNCTION(rrd_update)
-{
- pval *file, *opt;
- char **argv;
-
- if ( rrd_test_error() )
- rrd_clear_error();
-
- if ( ZEND_NUM_ARGS() == 2 &&
- zend_get_parameters(ht, 2, &file, &opt) == SUCCESS )
- {
- convert_to_string(file);
- convert_to_string(opt);
-
- argv = (char **) emalloc(4 * sizeof(char *));
-
- argv[0] = "dummy";
- argv[1] = estrdup("update");
- argv[2] = estrdup(file->value.str.val);
- argv[3] = estrdup(opt->value.str.val);
-
- optind = 0; opterr = 0;
- if ( rrd_update(3, &argv[1]) != -1 )
- {
- RETVAL_TRUE;
- }
- else
- {
- RETVAL_FALSE;
- }
- efree(argv[1]); efree(argv[2]); efree(argv[3]);
- efree(argv);
- }
- else
- {
- WRONG_PARAM_COUNT;
- }
- return;
-}
-/* }}} */
-
-
-
-/* {{{ proto int rrd_last(string file)
- Gets last update time of an RRD file */
-
-PHP_FUNCTION(rrd_last)
-{
- pval *file;
- unsigned long retval;
-
- char **argv = (char **) emalloc(3 * sizeof(char *));
-
- if ( rrd_test_error() )
- rrd_clear_error();
-
- if (zend_get_parameters(ht, 1, &file) == SUCCESS)
- {
- convert_to_string(file);
-
- argv[0] = "dummy";
- argv[1] = estrdup("last");
- argv[2] = estrdup(file->value.str.val);
-
- optind = 0; opterr = 0;
- retval = rrd_last(2, &argv[1]);
-
- efree(argv[1]); efree(argv[2]);
- efree(argv);
- RETVAL_LONG(retval);
- }
- else
- {
- WRONG_PARAM_COUNT;
- }
- return;
-}
-/* }}} */
-
-
-/* {{{ proto int rrd_create(string file, array args_arr, int argc)
- Create an RRD file with the options passed (passed via array) */
-
-PHP_FUNCTION(rrd_create)
+/* {{{ PHP_MINFO_FUNCTION */
+PHP_MINFO_FUNCTION(rrdtool)
{
- pval *file, *args, *p_argc;
- pval *entry;
- char **argv;
- HashTable *args_arr;
- int argc, i;
-
- if ( rrd_test_error() )
- rrd_clear_error();
-
- if ( ZEND_NUM_ARGS() == 3 &&
- getParameters(ht, 3, &file, &args, &p_argc) == SUCCESS )
- {
- if ( args->type != IS_ARRAY )
- {
- php_error(E_WARNING, "2nd Variable passed to rrd_create is not an array!\n");
- RETURN_FALSE;
- }
-
- convert_to_long(p_argc);
- convert_to_string(file);
-
- convert_to_array(args);
- args_arr = args->value.ht;
- zend_hash_internal_pointer_reset(args_arr);
-
- argc = p_argc->value.lval + 3;
- argv = (char **) emalloc(argc * sizeof(char *));
-
- argv[0] = "dummy";
- argv[1] = estrdup("create");
- argv[2] = estrdup(file->value.str.val);
-
- for (i = 3; i < argc; i++)
- {
- pval **dataptr;
-
- if ( zend_hash_get_current_data(args_arr, (void *) &dataptr) == FAILURE )
- continue;
-
- entry = *dataptr;
-
- if ( entry->type != IS_STRING )
- convert_to_string(entry);
-
- argv[i] = estrdup(entry->value.str.val);
-
- if ( i < argc )
- zend_hash_move_forward(args_arr);
- }
-
- optind = 0; opterr = 0;
-
- if ( rrd_create(argc-1, &argv[1]) != -1 )
- {
- RETVAL_TRUE;
- }
- else
- {
- RETVAL_FALSE;
- }
- for (i = 1; i < argc; i++)
- efree(argv[i]);
-
- efree(argv);
- }
- else
- {
- WRONG_PARAM_COUNT;
- }
- return;
+ php_info_print_box_start(1);
+ PUTS("<a href=\"http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/\" target=\"rrdtool\"><img border=\"0\" src=\"");
+ if (SG(request_info).request_uri) {
+ PUTS(SG(request_info).request_uri);
+ }
+ PUTS("?="RRDTOOL_LOGO_GUID"\" alt=\"ClamAV logo\" /></a>\n");
+ php_printf("<h1 class=\"p\">rrdtool Version %s</h1>\n", PHP_RRD_VERSION_STRING);
+ php_info_print_box_end();
+ php_info_print_table_start();
+ php_info_print_table_row(2, "rrdtool support", "enabled");
+ php_info_print_table_end();
}
/* }}} */
-
-
/* {{{ proto mixed rrd_graph(string file, array args_arr, int argc)
Creates a graph based on options passed via an array */
-
PHP_FUNCTION(rrd_graph)
{
pval *file, *args, *p_argc;
@@ -283,7 +131,7 @@ PHP_FUNCTION(rrd_graph)
if ( rrd_test_error() )
rrd_clear_error();
- if ( ZEND_NUM_ARGS() == 3 &&
+ if ( (ZEND_NUM_ARGS() >= 3 && ZEND_NUM_ARGS() <= 6) &&
zend_get_parameters(ht, 3, &file, &args, &p_argc) == SUCCESS)
{
if ( args->type != IS_ARRAY )
@@ -364,11 +212,8 @@ PHP_FUNCTION(rrd_graph)
}
/* }}} */
-
-
/* {{{ proto mixed rrd_fetch(string file, array args_arr, int p_argc)
Fetch info from an RRD file */
-
PHP_FUNCTION(rrd_fetch)
{
pval *file, *args, *p_argc;
@@ -376,7 +221,7 @@ PHP_FUNCTION(rrd_fetch)
pval *p_start, *p_end, *p_step, *p_ds_cnt;
HashTable *args_arr;
zval *p_ds_namv, *p_data;
- int i, argc;
+ int i, j, argc;
time_t start, end;
unsigned long step, ds_cnt;
char **argv, **ds_namv;
@@ -455,7 +300,8 @@ PHP_FUNCTION(rrd_fetch)
datap = data;
for (i = start; i <= end; i += step)
- add_next_index_double(p_data, *(datap++));
+ for (j = 0; j < ds_cnt; j++)
+ add_next_index_double(p_data, *(datap++));
free(data);
}
@@ -482,4 +328,286 @@ PHP_FUNCTION(rrd_fetch)
}
/* }}} */
+/* {{{ proto string rrd_error(void)
+ Get the error message set by the last rrd tool function call */
+PHP_FUNCTION(rrd_error)
+{
+ char *msg;
+
+ if ( rrd_test_error() )
+ {
+ msg = rrd_get_error();
+
+ RETVAL_STRING(msg, 1);
+ rrd_clear_error();
+ }
+ else
+ return;
+}
+/* }}} */
+
+/* {{{ proto void rrd_clear_error(void)
+ Clear the error set by the last rrd tool function call */
+PHP_FUNCTION(rrd_clear_error)
+{
+ if ( rrd_test_error() )
+ rrd_clear_error();
+
+ return;
+}
+/* }}} */
+
+/* {{{ proto int rrd_update(string file, string opt)
+ Update an RRD file with values specified */
+PHP_FUNCTION(rrd_update)
+{
+ pval *file, *opt;
+ char **argv;
+
+ if ( rrd_test_error() )
+ rrd_clear_error();
+
+ if ( ZEND_NUM_ARGS() == 2 &&
+ zend_get_parameters(ht, 2, &file, &opt) == SUCCESS )
+ {
+ convert_to_string(file);
+ convert_to_string(opt);
+
+ argv = (char **) emalloc(4 * sizeof(char *));
+
+ argv[0] = "dummy";
+ argv[1] = estrdup("update");
+ argv[2] = estrdup(file->value.str.val);
+ argv[3] = estrdup(opt->value.str.val);
+
+ optind = 0; opterr = 0;
+ if ( rrd_update(3, &argv[1]) != -1 )
+ {
+ RETVAL_TRUE;
+ }
+ else
+ {
+ RETVAL_FALSE;
+ }
+ efree(argv[1]); efree(argv[2]); efree(argv[3]);
+ efree(argv);
+ }
+ else
+ {
+ WRONG_PARAM_COUNT;
+ }
+ return;
+}
+/* }}} */
+
+/* {{{ proto int rrd_last(string file)
+ Gets last update time of an RRD file */
+PHP_FUNCTION(rrd_last)
+{
+ pval *file;
+ unsigned long retval;
+
+ char **argv = (char **) emalloc(3 * sizeof(char *));
+
+ if ( rrd_test_error() )
+ rrd_clear_error();
+
+ if (zend_get_parameters(ht, 1, &file) == SUCCESS)
+ {
+ convert_to_string(file);
+
+ argv[0] = "dummy";
+ argv[1] = estrdup("last");
+ argv[2] = estrdup(file->value.str.val);
+
+ optind = 0; opterr = 0;
+ retval = rrd_last(2, &argv[1]);
+
+ efree(argv[1]); efree(argv[2]);
+ efree(argv);
+ RETVAL_LONG(retval);
+ }
+ else
+ {
+ WRONG_PARAM_COUNT;
+ }
+ return;
+}
+/* }}} */
+
+/* {{{ proto int rrd_create(string file, array args_arr, int argc)
+ Create an RRD file with the options passed (passed via array) */
+PHP_FUNCTION(rrd_create)
+{
+ pval *file, *args, *p_argc;
+ pval *entry;
+ char **argv;
+ HashTable *args_arr;
+ int argc, i;
+
+ if ( rrd_test_error() )
+ rrd_clear_error();
+
+ if ( ZEND_NUM_ARGS() == 3 &&
+ getParameters(ht, 3, &file, &args, &p_argc) == SUCCESS )
+ {
+ if ( args->type != IS_ARRAY )
+ {
+ php_error(E_WARNING, "2nd Variable passed to rrd_create is not an array!\n");
+ RETURN_FALSE;
+ }
+
+ convert_to_long(p_argc);
+ convert_to_string(file);
+
+ convert_to_array(args);
+ args_arr = args->value.ht;
+ zend_hash_internal_pointer_reset(args_arr);
+
+ argc = p_argc->value.lval + 3;
+ argv = (char **) emalloc(argc * sizeof(char *));
+
+ argv[0] = "dummy";
+ argv[1] = estrdup("create");
+ argv[2] = estrdup(file->value.str.val);
+
+ for (i = 3; i < argc; i++)
+ {
+ pval **dataptr;
+
+ if ( zend_hash_get_current_data(args_arr, (void *) &dataptr) == FAILURE )
+ continue;
+
+ entry = *dataptr;
+
+ if ( entry->type != IS_STRING )
+ convert_to_string(entry);
+
+ argv[i] = estrdup(entry->value.str.val);
+
+ if ( i < argc )
+ zend_hash_move_forward(args_arr);
+ }
+
+ optind = 0; opterr = 0;
+
+ if ( rrd_create(argc-1, &argv[1]) != -1 )
+ {
+ RETVAL_TRUE;
+ }
+ else
+ {
+ RETVAL_FALSE;
+ }
+ for (i = 1; i < argc; i++)
+ efree(argv[i]);
+
+ efree(argv);
+ }
+ else
+ {
+ WRONG_PARAM_COUNT;
+ }
+ return;
+}
+/* }}} */
+
+PHP_FUNCTION(rrdtool_info)
+{
+
+ if (ZEND_NUM_ARGS()!=0) {
+ ZEND_WRONG_PARAM_COUNT();
+ RETURN_FALSE;
+ }
+
+ PUTS("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n");
+ PUTS("<html>");
+ PUTS("<head>\n");
+ PUTS("<style type=\"text/css\"><!--");
+ PUTS("body {background-color: #ffffff; color: #000000;}");
+ PUTS("body, td, th, h1, h2 {font-family: sans-serif;}");
+ PUTS("pre {margin: 0px; font-family: monospace;}");
+ PUTS("a:link {color: #000099; text-decoration: none; background-color: #ffffff;}");
+ PUTS("a:hover {text-decoration: underline;}");
+ PUTS("table {border-collapse: collapse;}");
+ PUTS(".center {text-align: center;}");
+ PUTS(".center table { margin-left: auto; margin-right: auto; text-align: left;}");
+ PUTS(".center th { text-align: center !important; }");
+ PUTS("td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}");
+ PUTS("h1 {font-size: 150%;}");
+ PUTS("h2 {font-size: 125%;}");
+ PUTS(".p {text-align: left;}");
+ PUTS(".e {background-color: #ccccff; font-weight: bold; color: #000000;}");
+ PUTS(".h {background-color: #9999cc; font-weight: bold; color: #000000;}");
+ PUTS(".v {background-color: #cccccc; color: #000000;}");
+ PUTS("i {color: #666666; background-color: #cccccc;}");
+ PUTS("img {float: right; border: 0px;}");
+ PUTS("hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}");
+ PUTS("//--></style>");
+ PUTS("<title>rrdtool_info()</title>");
+ PUTS("</head>\n");
+ PUTS("<body><div class=\"center\">\n");
+
+ php_info_print_box_start(1);
+ PUTS("<a href=\"http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/\" target=\"rrdtool\"><img border=\"0\" src=\"");
+ if (SG(request_info).request_uri) {
+ PUTS(SG(request_info).request_uri);
+ }
+ PUTS("?="RRDTOOL_LOGO_GUID"\" alt=\"ClamAV logo\" /></a>\n");
+ php_printf("<h1 class=\"p\">rrdtool Version %s</h1>\n", PHP_RRD_VERSION_STRING);
+ php_info_print_box_end();
+ php_info_print_table_start();
+ php_info_print_table_row(2, "System", PHP_UNAME );
+ php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__ );
+ php_info_print_table_row(2, "rrdtool Support","Enabled");
+ php_info_print_table_end();
+
+ PUTS("<h2>RRDTOOL Copyright</h2>\n");
+ php_info_print_box_start(0);
+ PUTS("COPYRIGHT STATEMENT FOLLOWS THIS LINE</p>\n<blockquote>\n");
+ PUTS("<p>Portions copyright 2005 by Dale Walsh (buildsmart@daleenterprise.com).</p>\n");
+ PUTS("<p>Portions relating to rrdtool 1999, 2000, 2001, 2002, 2003, 2004, 2005 by Tobias Oetiker.</p>\n");
+ php_info_print_box_end();
+ PUTS("<h2>RRDTOOL License</h2>\n");
+ php_info_print_box_start(0);
+ PUTS("<p><b>Permission has been granted to copy, distribute and modify rrd in any context without fee, including a commercial application, provided that this notice is present in user-accessible supporting documentation. </b></p>");
+ PUTS("<p>This does not affect your ownership of the derived work itself, and the intent is to assure proper credit for the authors of rrdtool, not to interfere with your productive use of rrdtool. If you have questions, ask. \"Derived works\" ");
+ PUTS("includes all programs that utilize the library. Credit must be given in user-accessible documentation.</p>\n");
+ PUTS("<p><b>This software is provided \"AS IS.\"</b> The copyright holders disclaim all warranties, either express or implied, including but not limited to implied warranties of merchantability and fitness for a particular purpose, ");
+ PUTS("with respect to this code and accompanying documentation.</p>\n");
+ php_info_print_box_end();
+ PUTS("<h2>Special Thanks</h2>\n");
+ php_info_print_box_start(0);
+ PUTS("<p>Perl by Larry Wall");
+ PUTS("<p>gd library by Thomas Boutell");
+ PUTS("<p>gifcode from David Koblas");
+ PUTS("<p>libpng by Glenn Randers-Pehrson / Andreas Eric Dilger / Guy Eric Schalnat");
+ PUTS("<p>cgilib by Martin Schulze");
+ PUTS("<p>zlib by Jean-loup Gailly and Mark Adler");
+ PUTS("<p>Portions relating to php4 and php5 bindings, Dale Walsh (buildsmart@daleenterprise.com)");
+ php_info_print_box_end();
+
+ PUTS("</div></body></html>");
+}
+/* }}} */
+
+PHP_FUNCTION(rrdtool_logo_guid)
+{
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ RETURN_STRINGL(RRDTOOL_LOGO_GUID, sizeof(RRDTOOL_LOGO_GUID)-1, 1);
+}
+/* }}} */
+
#endif /* HAVE_RRDTOOL */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff -Naurp php4/rrdtool_logo.h php4.updated/rrdtool_logo.h
--- php4/rrdtool_logo.h 1969-12-31 19:00:00.000000000 -0500
+++ php4.updated/rrdtool_logo.h 2007-06-15 10:42:38.000000000 -0400

View File

@ -2,21 +2,20 @@
%define with_php %{?_without_php: 0} %{?!_without_php: 1}
%define with_tcl %{?_without_tcl: 0} %{?!_without_tcl: 1}
%define with_ruby %{?_without_ruby: 0} %{?!_without_ruby: 1}
%define php_rrd_svn r1127
%define php_extdir %(php-config --extension-dir 2>/dev/null || echo %{_libdir}/php4)
%define svnrev r1127
%define svnrev r1144
Summary: Round Robin Database Tool to store and display time-series data
Name: rrdtool
Version: 1.2.999
Release: 0.2.%{svnrev}%{?dist}
Release: 0.3.%{svnrev}%{?dist}
License: GPL
Group: Applications/Databases
URL: http://oss.oetiker.ch/rrdtool/
# svn checkout svn://svn.oetiker.ch/rrdtool/trunk/program
Source0: %{name}-%{version}-%{svnrev}.tar.gz
#Source0: http://oss.oetiker.ch/%{name}/pub/%{name}-%{version}.tar.gz
Source1: php4-%{php_rrd_svn}.tar.gz
Source1: php4-%{svnrev}.tar.gz
Patch0: rrdtool-1.2.999-php.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gcc-c++, openssl-devel, freetype-devel
@ -95,8 +94,15 @@ Group: Development/Languages
BuildRequires: php-devel >= 4.0
Requires: php >= 4.0
Requires: %{name} = %{version}-%{release}
%if 0%{?php_zend_api}
Requires: php(zend-abi) = %{php_zend_api}
Requires: php(api) = %{php_core_api}
%else
Requires: php-api = %{php_apiver}
%endif
Obsoletes: php-%{name} < %{version}-%{release}
Provides: php-%{name} = %{version}-%{release}
Provides: php-pecl(rrdtool)
%description php
The %{name}-php package includes a dynamic shared object (DSO) that adds
@ -316,6 +322,10 @@ find examples/ -type f -exec chmod 0644 {} \;
%endif
%changelog
* Tue Jul 10 2007 Jarod Wilson <jwilson@redhat.com> 1.2.999-0.3.r1144
- Update to latest rrdtool pre-1.3 svn snapshot (svn r1144)
- Add php abi check (Resolves: #247339)
* Fri Jun 15 2007 Jarod Wilson <jwilson@redhat.com> 1.2.999-0.2.r1127
- Fix up BuildRequires

View File

@ -1,2 +1,2 @@
eb174c886c56148b1e7ee35307e2f62e php4-r1127.tar.gz
90b44ce5aeec29ba7bb52979dc4616df rrdtool-1.2.999-r1127.tar.gz
4567af169ddfbb2e69051e0f4358dff6 php4-r1144.tar.gz
6c5fcd97ef74ade603679947b43ea17b rrdtool-1.2.999-r1144.tar.gz