chregu Tue Oct 2 06:32:17 2007 UTC Modified files: /php-src/ext/xsl php_xsl.c php_xsl.h xsl_fe.h xsltprocessor.c Log: - Added xsl->setProfiling() for profiling stylesheets. (MFB) http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/php_xsl.c?r1=1.43&r2=1.44&diff_format=u Index: php-src/ext/xsl/php_xsl.c diff -u php-src/ext/xsl/php_xsl.c:1.43 php-src/ext/xsl/php_xsl.c:1.44 --- php-src/ext/xsl/php_xsl.c:1.43 Fri Sep 28 05:32:41 2007 +++ php-src/ext/xsl/php_xsl.c Tue Oct 2 06:32:16 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_xsl.c,v 1.43 2007/09/28 05:32:41 tony2001 Exp $ */ +/* $Id: php_xsl.c,v 1.44 2007/10/02 06:32:16 chregu Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -123,6 +123,7 @@ intern->registered_phpfunctions = NULL; intern->node_list = NULL; intern->doc = NULL; + intern->profiling = NULL; zend_object_std_init(&intern->std, class_type TSRMLS_CC); zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/php_xsl.h?r1=1.17&r2=1.18&diff_format=u Index: php-src/ext/xsl/php_xsl.h diff -u php-src/ext/xsl/php_xsl.h:1.17 php-src/ext/xsl/php_xsl.h:1.18 --- php-src/ext/xsl/php_xsl.h:1.17 Mon Jan 1 09:29:34 2007 +++ php-src/ext/xsl/php_xsl.h Tue Oct 2 06:32:16 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_xsl.h,v 1.17 2007/01/01 09:29:34 sebastian Exp $ */ +/* $Id: php_xsl.h,v 1.18 2007/10/02 06:32:16 chregu Exp $ */ #ifndef PHP_XSL_H #define PHP_XSL_H @@ -60,6 +60,7 @@ HashTable *registered_phpfunctions; HashTable *node_list; php_libxml_node_object *doc; + char *profiling; } xsl_object; void php_xsl_set_object(zval *wrapper, void *obj TSRMLS_DC); http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/xsl_fe.h?r1=1.12&r2=1.13&diff_format=u Index: php-src/ext/xsl/xsl_fe.h diff -u php-src/ext/xsl/xsl_fe.h:1.12 php-src/ext/xsl/xsl_fe.h:1.13 --- php-src/ext/xsl/xsl_fe.h:1.12 Fri Sep 28 05:32:07 2007 +++ php-src/ext/xsl/xsl_fe.h Tue Oct 2 06:32:16 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xsl_fe.h,v 1.12 2007/09/28 05:32:07 tony2001 Exp $ */ +/* $Id: xsl_fe.h,v 1.13 2007/10/02 06:32:16 chregu Exp $ */ #ifndef XSL_FE_H #define XSL_FE_H @@ -33,4 +33,5 @@ PHP_FUNCTION(xsl_xsltprocessor_remove_parameter); PHP_FUNCTION(xsl_xsltprocessor_has_exslt_support); PHP_FUNCTION(xsl_xsltprocessor_register_php_functions); +PHP_FUNCTION(xsl_xsltprocessor_set_profiling); #endif http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/xsltprocessor.c?r1=1.57&r2=1.58&diff_format=u Index: php-src/ext/xsl/xsltprocessor.c diff -u php-src/ext/xsl/xsltprocessor.c:1.57 php-src/ext/xsl/xsltprocessor.c:1.58 --- php-src/ext/xsl/xsltprocessor.c:1.57 Thu Sep 27 18:28:43 2007 +++ php-src/ext/xsl/xsltprocessor.c Tue Oct 2 06:32:16 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xsltprocessor.c,v 1.57 2007/09/27 18:28:43 dmitry Exp $ */ +/* $Id: xsltprocessor.c,v 1.58 2007/10/02 06:32:16 chregu Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -44,6 +44,7 @@ PHP_FALIAS(removeParameter, xsl_xsltprocessor_remove_parameter, NULL) PHP_FALIAS(hasExsltSupport, xsl_xsltprocessor_has_exslt_support, NULL) PHP_FALIAS(registerPHPFunctions, xsl_xsltprocessor_register_php_functions, NULL) + PHP_FALIAS(setProfiling, xsl_xsltprocessor_set_profiling, NULL) {NULL, NULL, NULL} }; @@ -425,6 +426,7 @@ int clone; zval *doXInclude, *member; zend_object_handlers *std_hnd; + FILE *f; node = php_libxml_import_node(docp TSRMLS_CC); @@ -440,6 +442,17 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No stylesheet associated to this object"); return NULL; } + + if (intern->profiling) { + if (php_check_open_basedir(intern->profiling TSRMLS_CC)) { + f = NULL; + } else { + f = VCWD_FOPEN(intern->profiling, "w"); + } + } else { + f = NULL; + } + if (intern->parameter) { params = php_xsl_xslt_make_params(intern->parameter, 0 TSRMLS_CC); } @@ -470,8 +483,10 @@ } efree(member); - newdocp = xsltApplyStylesheetUser(style, doc, (const char**) params, NULL, NULL, ctxt); - + newdocp = xsltApplyStylesheetUser(style, doc, (const char**) params, NULL, f, ctxt); + if (f) { + fclose(f); + } xsltFreeTransformContext(ctxt); if (intern->node_list != NULL) { @@ -484,6 +499,9 @@ efree(intern->doc); intern->doc = NULL; + if (intern->profiling) { + efree(intern->profiling); + } if (params) { clone = 0; @@ -804,6 +822,31 @@ } /* }}} end xsl_xsltprocessor_register_php_functions(); */ +/* {{{ proto bool xsl_xsltprocessor_set_profiling(string filename) */ +PHP_FUNCTION(xsl_xsltprocessor_set_profiling) +{ + + zval *id; + zval *array_value, **entry, *new_string; + xsl_object *intern; + char *filename; + int filename_len; + DOM_GET_THIS(id); + + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == SUCCESS) { + intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); + + intern->profiling = estrndup(filename,filename_len); + + RETURN_TRUE; + + } else { + WRONG_PARAM_COUNT; + } + +} +/* }}} end xsl_xsltprocessor_set_profiling */ + /* {{{ proto bool xsl_xsltprocessor_has_exslt_support() U */ PHP_FUNCTION(xsl_xsltprocessor_has_exslt_support)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php