diff options
author | Dmitry Stogov <dmitry@zend.com> | 2013-11-26 11:36:23 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2013-11-26 11:36:23 +0400 |
commit | 621f83e35c96e488051787b413d7987427b75133 (patch) | |
tree | c57adc1341a222670d1389ab64561c14466e5cd8 /ext/opcache | |
parent | b3c2c2bcb136945d814be20b12fda27992a01769 (diff) | |
parent | a8c7e50f4d7d73797615734978259d640b3835c1 (diff) | |
download | php-git-621f83e35c96e488051787b413d7987427b75133.tar.gz |
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
Fixed bug #65559 (Opcache: cache not cleared if changes occur while running)
bring the news
Conflicts:
NEWS
Diffstat (limited to 'ext/opcache')
-rw-r--r-- | ext/opcache/README | 6 | ||||
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 11 | ||||
-rw-r--r-- | ext/opcache/ZendAccelerator.h | 1 | ||||
-rw-r--r-- | ext/opcache/zend_accelerator_module.c | 3 |
4 files changed, 19 insertions, 2 deletions
diff --git a/ext/opcache/README b/ext/opcache/README index 2e30d92c00..cb6ac342c4 100644 --- a/ext/opcache/README +++ b/ext/opcache/README @@ -103,6 +103,12 @@ opcache.revalidate_freq (default "2") memory storage allocation. ("1" means validate once per second, but only once per request. "0" means always validate) +opcache.file_update_protection (default "2") + Prevents caching files that are less than this number of seconds old. + It protects from caching of incompletely updated files. In case all file + updates on your site are atomic, you may increase performance setting it + to "0". + opcache.revalidate_path (default "0") Enables or disables file search in include_path optimization If the file search is disabled and a cached file is found that uses diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 0d7b94057b..bccd2b5e74 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1335,7 +1335,9 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han } #endif - if (ZCG(accel_directives).validate_timestamps || ZCG(accel_directives).max_file_size > 0) { + if (ZCG(accel_directives).validate_timestamps || + ZCG(accel_directives).file_update_protection || + ZCG(accel_directives).max_file_size > 0) { size_t size = 0; /* Obtain the file timestamps, *before* actually compiling them, @@ -1351,6 +1353,13 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han return NULL; } + /* check if file is too new (may be it's not written completely yet) */ + if (ZCG(accel_directives).file_update_protection && + (ZCG(request_time) - ZCG(accel_directives).file_update_protection < timestamp)) { + *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); + return NULL; + } + if (ZCG(accel_directives).max_file_size > 0 && size > (size_t)ZCG(accel_directives).max_file_size) { ZCSG(blacklist_misses)++; *op_array_p = accelerator_orig_compile_file(file_handle, type TSRMLS_CC); diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 2f6ee068e8..487010ba27 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -229,6 +229,7 @@ typedef struct _zend_accel_directives { zend_bool inherited_hack; zend_bool enable_cli; unsigned long revalidate_freq; + unsigned long file_update_protection; char *error_log; #ifdef ZEND_WIN32 char *mmap_base; diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 2ee02a60ce..cd840fd7dd 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -259,7 +259,8 @@ ZEND_INI_BEGIN() STD_PHP_INI_ENTRY("opcache.consistency_checks" , "0" , PHP_INI_ALL , OnUpdateLong, accel_directives.consistency_checks, zend_accel_globals, accel_globals) STD_PHP_INI_ENTRY("opcache.force_restart_timeout" , "180" , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.force_restart_timeout, zend_accel_globals, accel_globals) STD_PHP_INI_ENTRY("opcache.revalidate_freq" , "2" , PHP_INI_ALL , OnUpdateLong, accel_directives.revalidate_freq, zend_accel_globals, accel_globals) - STD_PHP_INI_ENTRY("opcache.preferred_memory_model", "" , PHP_INI_SYSTEM, OnUpdateStringUnempty, accel_directives.memory_model, zend_accel_globals, accel_globals) + STD_PHP_INI_ENTRY("opcache.file_update_protection", "2" , PHP_INI_ALL , OnUpdateLong, accel_directives.file_update_protection, zend_accel_globals, accel_globals) + STD_PHP_INI_ENTRY("opcache.preferred_memory_model", "" , PHP_INI_SYSTEM, OnUpdateStringUnempty, accel_directives.memory_model, zend_accel_globals, accel_globals) STD_PHP_INI_ENTRY("opcache.blacklist_filename" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.user_blacklist_filename, zend_accel_globals, accel_globals) STD_PHP_INI_ENTRY("opcache.max_file_size" , "0" , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.max_file_size, zend_accel_globals, accel_globals) |