com php-src: Ability to disable O+ per process (or process pool): ZendAccelerator.c zend_accelerator_module.c
| From: | Dmitry Stogov | Date: | Mon, 25 Feb 2013 06:35:59 +0000 |
| Subject: | com php-src: Ability to disable O+ per process (or process pool): ZendAccelerator.c zend_accelerator_module.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-71509@lists.php.net to get a copy of this message | ||
Commit: ce69b869279d11e176ad19f361bf1dccfcdad5af
Author: Dmitry Stogov <dmitry@zend.com> Mon, 25 Feb 2013 10:35:59 +0400
Parents: 0c220d6fb3a9865a37eabbbc1ed5588c0aad5674
Branches: PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ce69b869279d11e176ad19f361bf1dccfcdad5af
Log:
Ability to disable O+ per process (or process pool)
Changed paths:
M ZendAccelerator.c
M zend_accelerator_module.c
Diff:
diff --git a/ZendAccelerator.c b/ZendAccelerator.c
index eeb82de..eb540ed 100644
--- a/ZendAccelerator.c
+++ b/ZendAccelerator.c
@@ -191,7 +191,7 @@ static ZEND_INI_MH(accel_include_path_on_modify)
if (ZCG(include_path) && *ZCG(include_path)) {
ZCG(include_path_len) = new_value_length;
- if (accel_startup_ok &&
+ if (ZCG(enabled) && accel_startup_ok &&
(ZCG(counted) || ZCSG(accelerator_enabled)) &&
!zend_accel_hash_is_full(&ZCSG(include_paths))) {
@@ -900,7 +900,7 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt
include_path = ZCG(include_path);
include_path_len = ZCG(include_path_len);
if (ZCG(include_path_check) &&
- accel_startup_ok &&
+ ZCG(enabled) && accel_startup_ok &&
(ZCG(counted) || ZCSG(accelerator_enabled)) &&
!zend_accel_hash_is_full(&ZCSG(include_paths))) {
@@ -1291,7 +1291,7 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle,
int
int from_shared_memory; /* if the script we've got is stored in SHM */
if (!file_handle->filename ||
- !accel_startup_ok ||
+ !ZCG(enabled) || !accel_startup_ok ||
(!ZCG(counted) && !ZCSG(accelerator_enabled)) ||
CG(interactive) ||
(ZCSG(restart_in_progress) && accel_restart_is_active(TSRMLS_C))) {
@@ -1597,7 +1597,7 @@ static char *accel_php_resolve_path(const char *filename, int filename_length,
c
/* zend_stream_open_function() replacement for PHP 5.2 */
static int persistent_stream_open_function(const char *filename, zend_file_handle *handle
TSRMLS_DC)
{
- if (accel_startup_ok &&
+ if (ZCG(enabled) && accel_startup_ok &&
(ZCG(counted) || ZCSG(accelerator_enabled)) &&
!CG(interactive) &&
!ZCSG(restart_in_progress)) {
@@ -1693,7 +1693,7 @@ static int persistent_stream_open_function(const char *filename,
zend_file_handl
/* zend_stream_open_function() replacement for PHP 5.3 and above */
static int persistent_stream_open_function(const char *filename, zend_file_handle *handle
TSRMLS_DC)
{
- if (accel_startup_ok &&
+ if (ZCG(enabled) && accel_startup_ok &&
(ZCG(counted) || ZCSG(accelerator_enabled)) &&
!CG(interactive) &&
!ZCSG(restart_in_progress)) {
@@ -1758,7 +1758,7 @@ static int persistent_stream_open_function(const char *filename,
zend_file_handl
/* zend_resolve_path() replacement for PHP 5.3 and above */
static char* persistent_zend_resolve_path(const char *filename, int filename_len TSRMLS_DC)
{
- if (accel_startup_ok &&
+ if (ZCG(enabled) && accel_startup_ok &&
(ZCG(counted) || ZCSG(accelerator_enabled)) &&
!CG(interactive) &&
!ZCSG(restart_in_progress)) {
@@ -1864,7 +1864,7 @@ static void accel_activate(void)
{
TSRMLS_FETCH();
- if (!accel_startup_ok) {
+ if (!ZCG(enabled) || !accel_startup_ok) {
return;
}
@@ -2116,7 +2116,7 @@ static void accel_deactivate(void)
*/
TSRMLS_FETCH();
- if (!accel_startup_ok) {
+ if (!ZCG(enabled) || !accel_startup_ok) {
return;
}
@@ -2442,7 +2442,7 @@ static void accel_shutdown(zend_extension *extension)
zend_accel_blacklist_shutdown(&accel_blacklist);
- if (!accel_startup_ok) {
+ if (!ZCG(enabled) || !accel_startup_ok) {
accel_free_ts_resources();
return;
}
@@ -2528,7 +2528,7 @@ static void accel_op_array_handler(zend_op_array *op_array)
{
TSRMLS_FETCH();
- if (accel_startup_ok && ZCSG(accelerator_enabled)) {
+ if (ZCG(enabled) && accel_startup_ok && ZCSG(accelerator_enabled)) {
zend_optimizer(op_array TSRMLS_CC);
}
}
diff --git a/zend_accelerator_module.c b/zend_accelerator_module.c
index 45ed12a..58fc48d 100644
--- a/zend_accelerator_module.c
+++ b/zend_accelerator_module..c
@@ -342,7 +342,7 @@ static ZEND_MINIT_FUNCTION(zend_accelerator)
void zend_accel_override_file_functions(TSRMLS_D)
{
zend_function *old_function;
- if (accel_startup_ok && ZCG(accel_directives).file_override_enabled) {
+ if (ZCG(enabled) && accel_startup_ok &&
ZCG(accel_directives).file_override_enabled) {
/* override file_exists */
if (zend_hash_find(CG(function_table), "file_exists", sizeof("file_exists"),
(void **)&old_function) == SUCCESS) {
old_function->internal_function.handler = accel_file_exists;
@@ -368,7 +368,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
{
php_info_print_table_start();
- if (accel_startup_ok && ZCSG(accelerator_enabled)) {
+ if (ZCG(enabled) && accel_startup_ok && ZCSG(accelerator_enabled)) {
php_info_print_table_row(2, "Opcode Caching", "Up and Running");
} else {
php_info_print_table_row(2, "Opcode Caching", "Disabled");
@@ -378,11 +378,13 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
} else {
php_info_print_table_row(2, "Optimization", "Disabled");
}
- if (!accel_startup_ok || zps_api_failure_reason) {
- php_info_print_table_row(2, "Startup Failed", zps_api_failure_reason);
- } else {
- php_info_print_table_row(2, "Startup", "OK");
- php_info_print_table_row(2, "Shared memory model", zend_accel_get_shared_model());
+ if (ZCG(enabled)) {
+ if (!accel_startup_ok || zps_api_failure_reason) {
+ php_info_print_table_row(2, "Startup Failed", zps_api_failure_reason);
+ } else {
+ php_info_print_table_row(2, "Startup", "OK");
+ php_info_print_table_row(2, "Shared memory model", zend_accel_get_shared_model());
+ }
}
php_info_print_table_end();
@@ -418,7 +420,7 @@ static zval* accelerator_get_scripts(TSRMLS_D)
struct timeval exec_time;
struct timeval fetch_time;
- if (!accel_startup_ok || !ZCSG(accelerator_enabled) || accelerator_shm_read_lock(TSRMLS_C) !=
SUCCESS) {
+ if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled) ||
accelerator_shm_read_lock(TSRMLS_C) != SUCCESS) {
return 0;
}
@@ -464,14 +466,14 @@ static ZEND_FUNCTION(accelerator_get_status)
/* keep the compiler happy */
(void)ht; (void)return_value_ptr; (void)this_ptr; (void)return_value_used;
- if (!accel_startup_ok || !ZCSG(accelerator_enabled)) {
+ if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) {
RETURN_FALSE;
}
array_init(return_value);
/* Trivia */
- add_assoc_bool(return_value, "accelerator_enabled", 1 /*accel_startup_ok &&
ZCSG(accelerator_enabled)*/);
+ add_assoc_bool(return_value, "accelerator_enabled", 1 /*ZCG(enabled) &&
accel_startup_ok && ZCSG(accelerator_enabled)*/);
add_assoc_bool(return_value, "cache_full", ZSMMG(memory_exhausted));
/* Memory usage statistics */
@@ -576,7 +578,7 @@ static ZEND_FUNCTION(accelerator_reset)
/* keep the compiler happy */
(void)ht; (void)return_value_ptr; (void)this_ptr; (void)return_value_used;
- if (!accel_startup_ok || !ZCSG(accelerator_enabled)) {
+ if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) {
RETURN_FALSE;
}