@@ -412,7 +412,7 @@ static zend_string *accel_find_interned_string(zend_string *str)
412412 }
413413
414414 if (!ZCG (counted )) {
415- if (accel_activate_add () == FAILURE ) {
415+ if (! ZCG ( accelerator_enabled ) || accel_activate_add () == FAILURE ) {
416416 return str ;
417417 }
418418 ZCG (counted ) = 1 ;
@@ -1070,7 +1070,7 @@ char *accel_make_persistent_key(const char *path, int path_length, int *key_len)
10701070 cwd_len = ZSTR_LEN (cwd_str );
10711071 if (ZCG (cwd_check )) {
10721072 ZCG (cwd_check ) = 0 ;
1073- if (( ZCG (counted ) || ZCSG ( accelerator_enabled ) )) {
1073+ if (ZCG (accelerator_enabled )) {
10741074
10751075 zend_string * str = accel_find_interned_string (cwd_str );
10761076 if (!str ) {
@@ -1110,7 +1110,7 @@ char *accel_make_persistent_key(const char *path, int path_length, int *key_len)
11101110
11111111 if (ZCG (include_path_check )) {
11121112 ZCG (include_path_check ) = 0 ;
1113- if (( ZCG (counted ) || ZCSG ( accelerator_enabled ) )) {
1113+ if (ZCG (accelerator_enabled )) {
11141114
11151115 zend_string * str = accel_find_interned_string (ZCG (include_path ));
11161116 if (!str ) {
@@ -1193,7 +1193,7 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc
11931193 zend_string * realpath ;
11941194 zend_persistent_script * persistent_script ;
11951195
1196- if (!ZCG (enabled ) || ! accel_startup_ok || ! ZCSG ( accelerator_enabled ) || accelerator_shm_read_lock () != SUCCESS ) {
1196+ if (!ZCG (accelerator_enabled ) || accelerator_shm_read_lock () != SUCCESS ) {
11971197 return FAILURE ;
11981198 }
11991199
@@ -1764,7 +1764,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
17641764 } else if (file_cache_only ) {
17651765 return file_cache_compile_file (file_handle , type );
17661766#endif
1767- } else if (( !ZCG (counted ) && ! ZCSG ( accelerator_enabled ) ) ||
1767+ } else if (!ZCG (accelerator_enabled ) ||
17681768 (ZCSG (restart_in_progress ) && accel_restart_is_active ())) {
17691769#ifdef HAVE_OPCACHE_FILE_CACHE
17701770 if (ZCG (accel_directives ).file_cache ) {
@@ -2059,12 +2059,11 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl
20592059/* zend_resolve_path() replacement for PHP 5.3 and above */
20602060static zend_string * persistent_zend_resolve_path (const char * filename , int filename_len )
20612061{
2062- if (ZCG ( enabled ) && accel_startup_ok &&
2062+ if (
20632063#ifdef HAVE_OPCACHE_FILE_CACHE
20642064 !file_cache_only &&
20652065#endif
2066- (ZCG (counted ) || ZCSG (accelerator_enabled )) &&
2067- !ZCSG (restart_in_progress )) {
2066+ ZCG (accelerator_enabled )) {
20682067
20692068 /* check if callback is called from include_once or it's a main request */
20702069 if ((!EG (current_execute_data ) &&
@@ -2213,6 +2212,7 @@ static void accel_activate(void)
22132212 zend_alter_ini_entry_chars (key , "0" , 1 , ZEND_INI_SYSTEM , ZEND_INI_STAGE_RUNTIME );
22142213 zend_string_release (key );
22152214 zend_accel_error (ACCEL_LOG_WARNING , "Can't cache files in chroot() directory with too big inode" );
2215+ ZCG (accelerator_enabled ) = 0 ;
22162216 return ;
22172217 }
22182218 }
@@ -2270,12 +2270,15 @@ static void accel_activate(void)
22702270 }
22712271 accel_restart_leave ();
22722272 }
2273- } else {
2273+ }
2274+ if (!ZCG (pcre_reseted )) {
22742275 reset_pcre = 1 ;
22752276 }
22762277 zend_shared_alloc_unlock ();
22772278 }
22782279
2280+ ZCG (accelerator_enabled ) = ZCSG (accelerator_enabled );
2281+
22792282 SHM_PROTECT ();
22802283 HANDLE_UNBLOCK_INTERRUPTIONS ();
22812284
@@ -2287,8 +2290,10 @@ static void accel_activate(void)
22872290 realpath_cache_clean ();
22882291
22892292 accel_reset_pcre_cache ();
2293+ ZCG (pcre_reseted ) = 0 ;
22902294 } else if (reset_pcre ) {
22912295 accel_reset_pcre_cache ();
2296+ ZCG (pcre_reseted ) = 1 ;
22922297 }
22932298}
22942299
@@ -2316,10 +2321,6 @@ static void accel_deactivate(void)
23162321 zend_string_release (ZCG (cwd ));
23172322 ZCG (cwd ) = NULL ;
23182323 }
2319-
2320- if (!ZCG (enabled ) || !accel_startup_ok ) {
2321- return ;
2322- }
23232324}
23242325
23252326static int accelerator_remove_cb (zend_extension * element1 , zend_extension * element2 )
0 commit comments