diff options
Diffstat (limited to 'ext/opcache/zend_accelerator_module.c')
| -rw-r--r-- | ext/opcache/zend_accelerator_module.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 8d6ed4ee27..94a6b6b190 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -43,6 +43,7 @@ static void (*orig_is_readable)(INTERNAL_FUNCTION_PARAMETERS) = NULL; /* User functions */ static ZEND_FUNCTION(opcache_reset); +static ZEND_FUNCTION(opcache_invalidate); /* Private functions */ static ZEND_FUNCTION(opcache_get_status); @@ -51,6 +52,7 @@ static ZEND_FUNCTION(opcache_get_configuration); static zend_function_entry accel_functions[] = { /* User functions */ ZEND_FE(opcache_reset, NULL) + ZEND_FE(opcache_invalidate, NULL) /* Private functions */ ZEND_FE(opcache_get_configuration, NULL) ZEND_FE(opcache_get_status, NULL) @@ -643,3 +645,22 @@ static ZEND_FUNCTION(opcache_reset) zend_accel_schedule_restart(ACCEL_RESTART_USER TSRMLS_CC); RETURN_TRUE; } + +/* {{{ proto void opcache_invalidate(string $script [, bool $force = false]) + Invalidates cached script (in necessary or forced) */ +static ZEND_FUNCTION(opcache_invalidate) +{ + char *script_name; + int script_name_len; + zend_bool force = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &script_name, &script_name_len, &force) == FAILURE) { + return; + } + + if (zend_accel_invalidate(script_name, script_name_len, force) == SUCCESS) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} |
