com php-src: Add optional flag to opcache_get_status() : ext/opcache/zend_accelerator_module.c
| From: | Dmitry Stogov | Date: | Mon, 18 Mar 2013 07:23:26 +0000 |
| Subject: | com php-src: Add optional flag to opcache_get_status() : ext/opcache/zend_accelerator_module.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-71600@lists.php.net to get a copy of this message | ||
Commit: ccf7d7cc93d91e621a5dfac341fd6e4dafdf4aaa
Author: Dmitry Stogov <dmitry@zend.com> Mon, 18 Mar 2013 11:23:26 +0400
Parents: fe384b34447b5c7f7f472b5a073b11f5d3a33401
Branches: PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ccf7d7cc93d91e621a5dfac341fd6e4dafdf4aaa
Log:
Add optional flag to opcache_get_status()
Changed paths:
M ext/opcache/zend_accelerator_module.c
Diff:
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index 4223a1f..50596aa 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -430,21 +430,20 @@ static zval* accelerator_get_scripts(TSRMLS_D)
return return_value;
}
-/* {{{ proto array accelerator_get_status()
- Obtain statistics information regarding code acceleration in the Zend Performance Suite */
+/* {{{ proto array accelerator_get_status([bool fetch_scripts])
+ Obtain statistics information regarding code acceleration */
static ZEND_FUNCTION(opcache_get_status)
{
long reqs;
zval *memory_usage,*statistics,*scripts;
+ zend_bool fetch_scripts = 1;
/* keep the compiler happy */
(void)ht; (void)return_value_ptr; (void)this_ptr; (void)return_value_used;
-#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
- if (zend_parse_parameters_none() == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &fetch_scripts) ==
FAILURE) {
+ return;
}
-#endif
if (!accel_startup_ok) {
RETURN_FALSE;
@@ -480,10 +479,12 @@ static ZEND_FUNCTION(opcache_get_status)
add_assoc_double(statistics, "opcache_hit_rate", reqs?(((double)
ZCSG(hits))/reqs)*100.0:0);
add_assoc_zval(return_value, "opcache_statistics", statistics);
- /* accelerated scripts */
- scripts = accelerator_get_scripts(TSRMLS_C);
- if (scripts) {
- add_assoc_zval(return_value, "scripts", scripts);
+ if (fetch_scripts) {
+ /* accelerated scripts */
+ scripts = accelerator_get_scripts(TSRMLS_C);
+ if (scripts) {
+ add_assoc_zval(return_value, "scripts", scripts);
+ }
}
}
@@ -494,7 +495,7 @@ static int add_blacklist_path(zend_blacklist_entry *p, zval *return_value TSRMLS
}
/* {{{ proto array accelerator_get_configuration()
- Obtain configuration information for the Zend Performance Suite */
+ Obtain configuration information */
static ZEND_FUNCTION(opcache_get_configuration)
{
zval *directives,*version,*blacklist;