static void accel_file_in_cache(int type, INTERNAL_FUNCTION_PARAMETERS) { char *filename; int filename_len; #if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO zval **zfilename; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfilename) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_string_ex(zfilename); filename = Z_STRVAL_PP(zfilename); filename_len = Z_STRLEN_PP(zfilename); #elif ZEND_EXTENSION_API_NO == PHP_5_3_X_API_NO if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { return; } #else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { return; } #endif if(filename_len > 0) { if(filename_is_in_cache(filename, filename_len TSRMLS_CC)) { RETURN_TRUE; } } php_stat(filename, filename_len, type, return_value TSRMLS_CC); }
static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS) { zval **zfilename; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, &zfilename) == FAILURE || Z_TYPE_PP(zfilename) != IS_STRING || Z_STRLEN_PP(zfilename) == 0) { return 0; } return filename_is_in_cache(Z_STRVAL_PP(zfilename), Z_STRLEN_PP(zfilename) TSRMLS_CC); }
/* {{{ proto bool opcache_is_script_cached(string $script) Return true if the script is cached in OPCache, false if it is not cached or if OPCache is not running. */ static ZEND_FUNCTION(opcache_is_script_cached) { zend_string *script_name; if (!validate_api_restriction()) { RETURN_FALSE; } if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) { RETURN_FALSE; } if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &script_name) == FAILURE) { return; } RETURN_BOOL(filename_is_in_cache(script_name)); }