Skip to content

Instantly share code, notes, and snippets.

@dstogov
Created November 5, 2014 02:33
Show Gist options
  • Save dstogov/a7d3e136c6e857ff02b5 to your computer and use it in GitHub Desktop.
Save dstogov/a7d3e136c6e857ff02b5 to your computer and use it in GitHub Desktop.
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index b5d446a..45ac067 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -874,13 +874,12 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri
int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC)
{
- if (ZCG(accel_directives).revalidate_freq &&
- (persistent_script->dynamic_members.revalidate >= ZCSG(revalidate_at))) {
+ if (persistent_script->dynamic_members.revalidate >= ZCG(request_time)) {
return SUCCESS;
} else if (do_validate_timestamps(persistent_script, file_handle TSRMLS_CC) == FAILURE) {
return FAILURE;
} else {
- persistent_script->dynamic_members.revalidate = ZCSG(revalidate_at);
+ persistent_script->dynamic_members.revalidate = ZCG(request_time) + ZCG(accel_directives).revalidate_freq;
return SUCCESS;
}
}
@@ -1421,7 +1420,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
* otherwise we have a race-condition.
*/
new_persistent_script->timestamp = timestamp;
- new_persistent_script->dynamic_members.revalidate = ZCSG(revalidate_at);
+ new_persistent_script->dynamic_members.revalidate = ZCG(request_time) + ZCG(accel_directives).revalidate_freq;
}
if (file_handle->opened_path) {
@@ -1891,13 +1890,6 @@ static void accel_activate(void)
zend_accel_error(ACCEL_LOG_WARNING, "Internal functions count changed - was %d, now %d", ZCG(internal_functions_count), zend_hash_num_elements(&ZCG(function_table)));
}
- if (ZCG(accel_directives).validate_timestamps) {
- time_t now = ZCG(request_time);
- if (now > ZCSG(revalidate_at) + (time_t)ZCG(accel_directives).revalidate_freq) {
- ZCSG(revalidate_at) = now;
- }
- }
-
ZCG(cwd) = NULL;
SHM_PROTECT();
@@ -2347,10 +2339,6 @@ static int accel_startup(zend_extension *extension)
accelerator_orig_zend_resolve_path = zend_resolve_path;
zend_resolve_path = persistent_zend_resolve_path;
- if (ZCG(accel_directives).validate_timestamps) {
- ZCSG(revalidate_at) = zend_accel_get_time() + ZCG(accel_directives).revalidate_freq;
- }
-
/* Override chdir() function */
if ((func = zend_hash_str_find_ptr(CG(function_table), "chdir", sizeof("chdir")-1)) != NULL &&
func->type == ZEND_INTERNAL_FUNCTION) {
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index 28c3d21..e6d742b 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -270,7 +270,7 @@ typedef struct _zend_accel_shared_globals {
LONGLONG restart_in;
#endif
zend_bool restart_in_progress;
- time_t revalidate_at;
+ time_t _revalidate_at;
/* Interned Strings Support */
char *interned_strings_start;
char *interned_strings_top;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment